FROM golang:1.26.1 as builder WORKDIR /app COPY backend/ backend/ COPY proto/ proto/ WORKDIR /app/backend ENV CGO_ENABLED=0 ENV GIN_MODE=release RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ go mod download && \ go build -ldflags "-s -w" -o backend ./cmd/main.go FROM alpine:3.23.0 RUN apk add --no-cache curl openssl bash ansible sqlite COPY --from=builder /app/backend/backend . COPY --from=builder /app/backend/scripts /etc/hellreign/scripts RUN chmod +x /etc/hellreign/scripts/generate-certs.sh # Generate certificates on container start ENTRYPOINT ["/bin/sh", "-c", "/etc/hellreign/scripts/generate-certs.sh ${SSL_CERT_DIR:-/var/lib/hellreign/ssl} && exec ./backend"]