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