30 lines
1023 B
Docker
30 lines
1023 B
Docker
FROM golang:1.24-alpine AS builder
|
|
|
|
WORKDIR /src
|
|
RUN apk add --no-cache ca-certificates git
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/api ./cmd/api \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/worker ./cmd/worker \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/migrate ./cmd/migrate \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/importer ./cmd/importer \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/admin ./cmd/admin \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/calendar ./cmd/calendar
|
|
|
|
FROM alpine:3.22
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata wget \
|
|
&& addgroup -S -g 10001 app \
|
|
&& adduser -S -D -H -u 10001 -G app app
|
|
|
|
WORKDIR /app
|
|
COPY --from=builder /out/ /app/
|
|
COPY --from=builder /src/migrations/ /app/migrations/
|
|
|
|
USER app:app
|
|
EXPOSE 8080
|
|
CMD ["/app/api"]
|