reproxy/Dockerfile

40 lines
948 B
Docker
Raw Normal View History

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"
ENV CGO_ENABLED=0
2021-04-04 06:26:53 +03:00
ADD . /build
WORKDIR /build
RUN apk add -u git
2021-04-04 06:26:53 +03:00
RUN \
if [ -z "$CI" ] ; then \
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"
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
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"]