All checks were successful
Check / check (pull_request) Successful in 1m27s
The lint stage only needs golangci-lint (built into base image) and gofmt for fmt-check. Neither make fmt-check nor make lint uses the goimports binary directly. Removing it makes the lint stage faster, which is the whole point of the multi-stage split. goimports is only used by 'make fmt' which is a local developer tool, not run during Docker builds.
47 lines
985 B
Docker
47 lines
985 B
Docker
# Lint stage — fast feedback on formatting and lint issues
|
|
# golangci/golangci-lint:v2.10.1
|
|
FROM golangci/golangci-lint@sha256:ea84d14c2fef724411be7dc45e09e6ef721d748315252b02df19a7e3113ee763 AS lint
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN make fmt-check
|
|
RUN make lint
|
|
|
|
# Build stage — tests and compilation
|
|
# golang:1.25-alpine
|
|
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
|
|
|
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"]
|