Files
template-go-web/Dockerfile
2026-05-12 21:47:36 +02:00

15 lines
406 B
Docker

FROM golang:1.26-alpine AS build
WORKDIR /src
RUN apk add --no-cache git
RUN go install github.com/a-h/templ/cmd/templ@latest
COPY go.mod ./
RUN go mod download
COPY . .
RUN templ generate && CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o /out/app ./cmd/hostexecutor
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/app /app
USER nonroot:nonroot
EXPOSE 8080
ENTRYPOINT ["/app"]