mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
39 lines
861 B
Docker
39 lines
861 B
Docker
# =========================
|
|
# Builder stage
|
|
# =========================
|
|
FROM golang:1.23-alpine AS builder
|
|
|
|
RUN apk add --no-cache git ca-certificates tzdata
|
|
WORKDIR /app
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
# Build API binary
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -trimpath -ldflags="-s -w" -o lti-api ./cmd/api
|
|
|
|
# Build SEED binary (pastikan cmd/seed ada)
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -trimpath -ldflags="-s -w" -o lti-seed ./cmd/seed
|
|
|
|
# =========================
|
|
# Runtime stage
|
|
# =========================
|
|
FROM alpine:3.20
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata curl bash postgresql-client \
|
|
&& adduser -D -H -u 10001 appuser
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/lti-api /app/lti-api
|
|
COPY --from=builder /app/lti-seed /app/lti-seed
|
|
|
|
USER appuser
|
|
EXPOSE 8081
|
|
|
|
CMD ["/app/lti-api"]
|