mirror of
https://github.com/Dvorinka/Productier.git
synced 2026-06-03 20:13:01 +00:00
29 lines
582 B
Docker
29 lines
582 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM golang:1.26-alpine AS build
|
|
WORKDIR /src
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -trimpath -ldflags='-s -w' -o /out/api ./cmd/api
|
|
|
|
FROM alpine:3.22 AS runtime
|
|
RUN apk add --no-cache ca-certificates tzdata \
|
|
&& addgroup -S app \
|
|
&& adduser -S -G app app
|
|
|
|
WORKDIR /app
|
|
COPY --from=build /out/api /app/api
|
|
COPY internal/db/migrations /app/migrations
|
|
|
|
ENV APP_ENV=production
|
|
ENV API_PORT=8080
|
|
ENV DB_MIGRATIONS_DIR=/app/migrations
|
|
|
|
EXPOSE 8080
|
|
USER app
|
|
ENTRYPOINT ["/app/api"]
|