35 lines
943 B
Docker
35 lines
943 B
Docker
# ── Stage 1: Build ─────────────────────────────────────────────────────────
|
|
FROM golang:1.26-alpine AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
COPY go.* ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o landing .
|
|
|
|
# ── Stage 2: Runtime ────────────────────────────────────────────────────────
|
|
FROM alpine:3.21 AS runtime
|
|
|
|
RUN apk add --no-cache ca-certificates && \
|
|
addgroup -S arcline && \
|
|
adduser -S -G arcline arcline
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /build/landing ./
|
|
COPY --from=builder /build/static ./static
|
|
COPY --from=builder /build/templates ./templates
|
|
|
|
RUN chown -R arcline:arcline /app
|
|
|
|
USER arcline
|
|
|
|
ENV PORT=8080
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["./landing"]
|