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'
|
2020-10-31 18:09:28 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-10-31 18:09:28 -05:00
|
|
|
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
|
2021-04-01 16:20:17 -05:00
|
|
|
|
2022-02-18 06:30:12 -06:00
|
|
|
FROM scratch
|
2020-10-31 18:09:28 -05:00
|
|
|
EXPOSE 80 443
|
2022-02-23 04:33:36 -06:00
|
|
|
WORKDIR /storage
|
2020-10-31 18:09:28 -05:00
|
|
|
|
2021-04-01 16:20:17 -05:00
|
|
|
COPY --from=builder /build/cmd/boringproxy/boringproxy /
|
2020-10-31 18:09:28 -05:00
|
|
|
|
|
|
|
ENTRYPOINT ["/boringproxy"]
|
2022-02-18 06:30:12 -06:00
|
|
|
CMD ["version"]
|