golang-http-header/Dockerfile

24 lines
384 B
Docker
Raw Normal View History

# Build stage
FROM golang:1.21.4-alpine AS builder
2023-11-22 15:45:57 +00:00
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 /
2023-11-22 15:45:57 +00:00
# network port at runtime
EXPOSE 8000
CMD ["/golang-http-header"]