Skip to content

Instantly share code, notes, and snippets.

@EvilFreelancer
Last active May 14, 2023 12:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvilFreelancer/4d9e675d3bc04980b599633c18702c9e to your computer and use it in GitHub Desktop.
Save EvilFreelancer/4d9e675d3bc04980b599633c18702c9e to your computer and use it in GitHub Desktop.
Dockerfile для GoLang-приложения
FROM golang:1.20 AS builder
WORKDIR /app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /app/
COPY --from=builder /app/main .
CMD ["/app/main"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment