2024-03-15 16:55:13 -05:00
|
|
|
FROM golang:1.22-alpine as backend
|
2021-04-03 22:26:53 -05:00
|
|
|
|
|
|
|
|
ARG GIT_BRANCH
|
|
|
|
|
ARG GITHUB_SHA
|
|
|
|
|
ARG CI
|
|
|
|
|
|
2021-04-11 14:12:40 -05:00
|
|
|
ENV CGO_ENABLED=0
|
2021-04-03 22:26:53 -05:00
|
|
|
|
|
|
|
|
ADD . /build
|
|
|
|
|
WORKDIR /build
|
|
|
|
|
|
2021-04-14 03:26:20 -05:00
|
|
|
RUN apk add --no-cache --update git tzdata ca-certificates
|
|
|
|
|
|
2021-04-03 22:26:53 -05:00
|
|
|
RUN \
|
|
|
|
|
if [ -z "$CI" ] ; then \
|
2021-04-11 17:10:40 -05:00
|
|
|
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
|
2021-04-03 22:26:53 -05:00
|
|
|
else version=${GIT_BRANCH}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
|
|
|
|
|
echo "version=$version" && \
|
|
|
|
|
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"
|
|
|
|
|
|
2024-05-09 17:44:28 +02:00
|
|
|
FROM umputun/baseimage:scratch-latest
|
2024-05-09 02:03:17 +02:00
|
|
|
# enables automatic changelog generation by tools like Dependabot
|
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy"
|
2021-05-03 14:38:48 -05:00
|
|
|
ENV REPROXY_IN_DOCKER=1
|
2021-04-11 14:22:15 -05:00
|
|
|
|
2021-04-03 22:26:53 -05:00
|
|
|
COPY --from=backend /build/reproxy /srv/reproxy
|
|
|
|
|
|
2021-04-14 03:26:20 -05:00
|
|
|
WORKDIR /srv
|
|
|
|
|
ENTRYPOINT ["/srv/reproxy"]
|