Check / check (pull_request) Successful in 1m29s
Per the owner ruling, linting now runs only inside Docker with the pinned golangci-lint (v2.12.2). A root Dockerfile.lint runs the linter as a build step; script/lint just builds it. A GATE_RUN build arg forces the lint layer to execute every run so a cached build cannot report a false clean. script/bootstrap no longer installs golangci-lint (the goimports install stays). The main Dockerfile lint stage calls golangci-lint directly (no docker-in-docker) and still gates the build. config verify is omitted because it fetches its schema over an unpinned HTTPS call. Model: opus-4-8
54 lines
1.4 KiB
Docker
54 lines
1.4 KiB
Docker
# Lint stage — fast feedback on formatting and lint issues
|
|
# golangci/golangci-lint:v2.12.2 (Debian-based), 2026-08-07
|
|
FROM golangci/golangci-lint:v2.12.2@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240 AS lint
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
# golangci-lint is invoked directly here, not via `make lint`: script/lint
|
|
# now runs the linter by building Dockerfile.lint, and shelling out to
|
|
# `docker build` from inside this image build would be docker-in-docker.
|
|
# This image is golangci/golangci-lint, so the pinned linter is on PATH.
|
|
RUN make fmt-check
|
|
RUN golangci-lint run --config .golangci.yml ./...
|
|
|
|
# Build stage — tests and compilation
|
|
# golang:1.25-alpine
|
|
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
|
|
|
# Force BuildKit to run the lint stage by creating a stage dependency
|
|
COPY --from=lint /src/go.sum /dev/null
|
|
|
|
RUN apk add --no-cache git make gcc musl-dev
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN make test
|
|
RUN make build
|
|
|
|
# Runtime stage
|
|
# alpine:3.19
|
|
FROM alpine@sha256:6baf43584bcb78f2e5847d1de515f23499913ac9f12bdf834811a3145eb11ca1
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata git openssh-client docker-cli
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /src/bin/upaasd /app/upaasd
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /var/lib/upaas
|
|
|
|
ENV UPAAS_DATA_DIR=/var/lib/upaas
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/app/upaasd"]
|