boringproxy/Dockerfile

32 lines
668 B
Docker
Raw Permalink Normal View History

2021-12-14 16:04:34 -06:00
FROM golang:1.17-alpine3.15 as builder
2022-02-18 06:30:12 -06:00
LABEL boringproxy=builder
ARG VERSION
ARG GOOS="linux"
ARG GOARCH="amd64"
ARG BRANCH="master"
ARG REPO="https://github.com/boringproxy/boringproxy.git"
ARG ORIGIN='local'
WORKDIR /build
RUN apk add git
2022-02-18 06:30:12 -06:00
RUN if [[ "ORIGIN" == 'remote' ]] ; then git clone --depth 1 --branch "${BRANCH}" ${REPO}; fi
COPY go.* ./
RUN go mod download
COPY . .
2022-02-18 06:30:12 -06:00
RUN cd cmd/boringproxy && CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} \
go build -ldflags "-X main.Version=${VERSION}" \
-o boringproxy
2022-02-18 06:30:12 -06:00
FROM scratch
EXPOSE 80 443
2022-02-23 04:33:36 -06:00
WORKDIR /storage
COPY --from=builder /build/cmd/boringproxy/boringproxy /
ENTRYPOINT ["/boringproxy"]
2022-02-18 06:30:12 -06:00
CMD ["version"]