Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-08-22 03:58:07 -04:00
pkg-proxy/Dockerfile
Andrew Nesbitt f0e6e11e8c
Upgrade to Go 1.26.6 (#246)
* Upgrade to Go 1.26.5

* Use go.mod to select Go 1.26.6
2026-08-16 18:22:26 +01:00

35 lines
663 B
Docker

FROM --platform=$BUILDPLATFORM golang:1.26.6-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"]