26 lines
798 B
Docker
26 lines
798 B
Docker
# syntax=docker/dockerfile:1.7
|
|
FROM golang:1.26-bookworm AS build
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
|
|
ARG TARGETOS=linux
|
|
ARG TARGETARCH=amd64
|
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
|
go build -trimpath -ldflags="-s -w" -o /out/proxy-gateway ./cmd/proxy-gateway && \
|
|
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
|
|
go build -trimpath -ldflags="-s -w" -o /out/proxy-controller ./cmd/proxy-controller
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends ca-certificates curl tini && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
useradd --uid 10001 --create-home --shell /usr/sbin/nologin proxy-pool
|
|
|
|
COPY --from=build /out/ /usr/local/bin/
|
|
USER 10001:10001
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|