golang-http-header/Dockerfile
Kris Crawford c7250311cf
All checks were successful
package-builder / build (push) Successful in 1m59s
go-builder / build (push) Successful in 35s
Testing multi-stage build and single file docker image
2024-06-21 17:38:01 -04:00

24 lines
384 B
Docker

# Build stage
FROM golang:1.21.4-alpine AS builder
WORKDIR /app
COPY go.mod ./
# download Go modules and dependencies
RUN go mod download
# copy all the Go files ending with .go extension
COPY *.go ./
RUN go build -o golang-http-header
# Final stage
FROM scratch
COPY --from=builder /app/golang-http-header /
# network port at runtime
EXPOSE 8000
CMD ["/golang-http-header"]