86173b61eb
Add multi-stage Dockerfile producing a minimal distroless image and Gitea Actions CI workflow for automated testing and image publishing. - Dockerfile: multi-stage build (golang:1.22-alpine -> distroless/static) with stripped binary (~15-20MB image), runs as nonroot user - .dockerignore: excludes .git, docs, nix files from build context - .gitea/workflows/build.yaml: CI pipeline that runs tests, builds Docker image, and pushes to Gitea registry with timestamp+SHA tags for Flux image automation Closes leeworks-agents/gitea-mobile#7 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
428 B
Docker
17 lines
428 B
Docker
# Stage 1: Build
|
|
FROM golang:1.22-alpine AS builder
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /gitea-mobile ./cmd/server
|
|
|
|
# Stage 2: Runtime
|
|
FROM gcr.io/distroless/static:nonroot
|
|
COPY --from=builder /gitea-mobile /gitea-mobile
|
|
COPY static/ /static/
|
|
COPY internal/templates/ /templates/
|
|
EXPOSE 8080
|
|
USER nonroot:nonroot
|
|
ENTRYPOINT ["/gitea-mobile"]
|