go-api-example/Dockerfile
YuukanOO 50fc4c1681
All checks were successful
continuous-integration/drone/push Build is passing
strip debug symbol when building
2023-05-01 16:22:28 +02:00

15 lines
309 B
Docker

FROM golang:1.19-alpine AS builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o api main.go
FROM alpine:3.14 AS runner
RUN addgroup --system app
RUN adduser --system app
USER app
WORKDIR /app
COPY --from=builder --chown=app:app /app/api ./
EXPOSE 8080
CMD ["./api"]