Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-09-16 07:42:05 -04:00
pkg-proxy/Dockerfile
Andrew Nesbitt a45befd067
Bump Dockerfile builder to golang:1.26.7-alpine (#315)
go.mod requires go 1.26.7; the 1.26.6 builder with GOTOOLCHAIN=local
refuses go mod download.
2026-09-04 13:37:47 +01:00

35 lines
663 B
Docker

FROM --platform=$BUILDPLATFORM golang:1.26.7-alpine AS builder
WORKDIR /src
# Install build dependencies
RUN apk add --no-cache git
# Copy go mod files first for caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the binary for the target platform
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /proxy ./cmd/proxy
FROM alpine:3.24.1
RUN apk add --no-cache ca-certificates
COPY --from=builder /proxy /usr/local/bin/proxy
# Create non-root user
RUN adduser -D -u 1000 proxy
USER proxy
# Default data directory
WORKDIR /data
EXPOSE 8080
ENTRYPOINT ["proxy"]
CMD ["serve"]