Quick fixes

This commit is contained in:
2026-02-16 09:24:32 +02:00
parent d4f5e9daa2
commit 904d26178f
2 changed files with 31 additions and 7 deletions

View File

@@ -1,12 +1,17 @@
FROM golang:1.24 AS build
WORKDIR /go/src/github.com/codemowers/hello-gin/
FROM golang:1.23-alpine AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY cmd ./
RUN go build -tags netgo -ldflags "-linkmode 'external' -extldflags '-static'" -o /go/server .
COPY cmd ./cmd/
COPY templates ./templates/
COPY static ./static/
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /app/server ./cmd
FROM scratch
WORKDIR /
COPY --from=build /go/server /server
COPY --from=build /app/server /server
COPY --from=build /app/templates /templates
COPY --from=build /app/static /static
ENV GIN_MODE=release
EXPOSE 8000 8080
ENTRYPOINT ["/server"]