From c6c05193c6869789deb118113ed5aa736e8f7ef0 Mon Sep 17 00:00:00 2001 From: maddalax Date: Sun, 20 Oct 2024 07:55:18 -0500 Subject: [PATCH] fix dockerfile --- examples/simple-auth/Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/simple-auth/Dockerfile b/examples/simple-auth/Dockerfile index 8f3a358..531b708 100644 --- a/examples/simple-auth/Dockerfile +++ b/examples/simple-auth/Dockerfile @@ -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 @@ -18,7 +14,9 @@ RUN go mod download COPY . . # Build the Go binary for Linux -RUN GOPRIVATE=github.com/maddalax GOPROXY=direct 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 + +RUN CGO_ENABLED=1 GOOS=linux go build -tags prod -o ./dist -a -ldflags '-linkmode external -extldflags "-static"' . # Stage 2: Create the smallest possible image