Clears 9 reachable stdlib govulncheck findings (all fixed in go1.27.2). Remaining: GO-2026-5932 (x/crypto/openpgp, module-level only, no fix available; our code does not call it).
36 lines
718 B
Docker
36 lines
718 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- build stage ----
|
|
FROM golang:1.27.2-alpine AS build
|
|
WORKDIR /src
|
|
|
|
# cache deps first
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
ARG VERSION=dev
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X palette/internal/web.Version=${VERSION}" -o /palette ./cmd/palette
|
|
|
|
# ---- runtime stage ----
|
|
FROM alpine:3.20
|
|
|
|
# non-root user
|
|
RUN adduser -D -u 10001 palette
|
|
|
|
COPY --from=build /palette /usr/local/bin/palette
|
|
|
|
USER palette
|
|
WORKDIR /data
|
|
|
|
ENV PALETTE_ADDR=":8080" \
|
|
PALETTE_DB="/data/palette.db"
|
|
|
|
EXPOSE 8080
|
|
VOLUME /data
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
|
|
CMD wget -qO- http://127.0.0.1:8080/ >/dev/null 2>&1 || exit 1
|
|
|
|
ENTRYPOINT ["palette"]
|