FROM golang:1.23-alpine AS builder RUN apk add --no-cache gcc musl-dev WORKDIR /build COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /metacrypt-web ./cmd/metacrypt-web FROM alpine:3.21 RUN apk add --no-cache ca-certificates tzdata \ && addgroup -S metacrypt \ && adduser -S -G metacrypt -h /srv/metacrypt -s /sbin/nologin metacrypt \ && mkdir -p /srv/metacrypt && chown metacrypt:metacrypt /srv/metacrypt COPY --from=builder /metacrypt-web /usr/local/bin/metacrypt-web # /srv/metacrypt is the single volume mount point. # It must contain: # metacrypt.toml — configuration file # certs/ — TLS certificate and key VOLUME /srv/metacrypt WORKDIR /srv/metacrypt EXPOSE 8080 USER metacrypt ENTRYPOINT ["metacrypt-web"] CMD ["--config", "/srv/metacrypt/metacrypt.toml"]