test
This commit is contained in:
parent
dc9476786b
commit
e34b8fe141
2 changed files with 10 additions and 10 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/maddalax/htmgo/cli/htmgo/tasks/copyassets"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/tasks/css"
|
||||
"github.com/maddalax/htmgo/cli/htmgo/tasks/process"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Build() {
|
||||
|
|
@ -19,8 +20,13 @@ func Build() {
|
|||
process.RunOrExit("rm -rf ./dist")
|
||||
process.RunOrExit("mkdir -p ./dist")
|
||||
|
||||
process.RunOrExit("env go build -o ./dist .")
|
||||
process.RunOrExit("go build -o ./dist/app .")
|
||||
flags := ""
|
||||
if os.Getenv("CGO_ENABLED") == "1" {
|
||||
flags = `-a -ldflags '-linkmode external -extldflags "-static"' `
|
||||
}
|
||||
|
||||
process.RunOrExit(fmt.Sprintf("go build -o ./dist/app %s.", flags))
|
||||
process.RunOrExit(fmt.Sprintf("go build -o ./dist/app %s.", flags))
|
||||
|
||||
fmt.Printf("Executable built at %s\n", process.GetPathRelativeToCwd("dist"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
# Stage 1: Build the Go binary
|
||||
FROM golang:1.23-alpine AS builder
|
||||
|
||||
RUN apk update
|
||||
RUN apk add git
|
||||
RUN apk add curl
|
||||
FROM golang:1.23 AS builder
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
|
@ -20,9 +16,7 @@ RUN go get github.com/maddalax/htmgo/framework@latest
|
|||
# Copy the source code into the container
|
||||
COPY . .
|
||||
|
||||
# Build the Go binary for Linux
|
||||
RUN GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@latest build
|
||||
|
||||
RUN CGO_ENABLED=1 GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@latest build
|
||||
|
||||
# Stage 2: Create the smallest possible image
|
||||
FROM gcr.io/distroless/base-debian11
|
||||
|
|
|
|||
Loading…
Reference in a new issue