mirror of
https://github.com/git-pkgs/proxy.git
synced 2026-08-22 03:58:07 -04:00
35 lines
663 B
Docker
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"]
|