2021-04-11 22:12:40 +03:00
|
|
|
FROM golang:1.16-alpine as backend
|
2021-04-04 06:26:53 +03:00
|
|
|
|
|
|
|
ARG GIT_BRANCH
|
|
|
|
ARG GITHUB_SHA
|
|
|
|
ARG CI
|
|
|
|
|
|
|
|
ENV GOFLAGS="-mod=vendor"
|
2021-04-11 22:12:40 +03:00
|
|
|
ENV CGO_ENABLED=0
|
2021-04-04 06:26:53 +03:00
|
|
|
|
|
|
|
ADD . /build
|
|
|
|
WORKDIR /build
|
|
|
|
|
2021-04-11 22:12:40 +03:00
|
|
|
RUN apk add -u git
|
2021-04-04 06:26:53 +03:00
|
|
|
RUN \
|
|
|
|
if [ -z "$CI" ] ; then \
|
2021-04-11 22:12:40 +03:00
|
|
|
echo "runs outside of CI" && version=$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
|
2021-04-04 06:26:53 +03: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"
|
|
|
|
|
|
|
|
|
2021-04-11 22:12:40 +03:00
|
|
|
FROM alpine:3.13
|
2021-04-04 06:26:53 +03:00
|
|
|
|
2021-04-11 22:22:15 +03:00
|
|
|
ENV \
|
|
|
|
TERM=xterm-color \
|
|
|
|
TIME_ZONE=America/Chicago
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
apk add --no-cache --update tzdata curl ca-certificates && \
|
|
|
|
cp /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime && \
|
|
|
|
echo "${TIME_ZONE}" > /etc/timezone && date && \
|
|
|
|
rm -rf /var/cache/apk/*
|
|
|
|
|
2021-04-04 06:26:53 +03:00
|
|
|
COPY --from=backend /build/reproxy /srv/reproxy
|
|
|
|
RUN chmod +x /srv/reproxy
|
2021-04-11 09:37:45 +03:00
|
|
|
LABEL reproxy.enabled="false"
|
2021-04-04 06:26:53 +03:00
|
|
|
WORKDIR /srv
|
|
|
|
|
2021-04-11 22:22:15 +03:00
|
|
|
ENTRYPOINT ["/srv/reproxy"]
|