Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-08-23 04:14:57 -04:00
pkg-proxy/Dockerfile
Ondrej Kokes bc1ea307f3
Multi-platform build (linux/amd64 and linux/arm64) (#230)
* wip

* pin to latest version, not commit

* test run

* Revert "test run"

This reverts commit 355e8f867e.
2026-08-06 22:03:20 +01:00

35 lines
663 B
Docker

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