1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00
reproxy/Dockerfile

42 lines
1.0 KiB
Docker
Raw Normal View History

FROM golang:1.16-alpine as backend
2021-04-04 05:26:53 +02:00
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG CI
ENV GOFLAGS="-mod=vendor"
ENV CGO_ENABLED=0
2021-04-04 05:26:53 +02:00
ADD . /build
WORKDIR /build
RUN apk add -u git
2021-04-04 05:26:53 +02:00
RUN \
if [ -z "$CI" ] ; then \
2021-04-12 00:10:40 +02: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-04 05:26:53 +02: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 05:26:53 +02:00
2021-04-11 21:22:15 +02:00
ENV \
TERM=xterm-color \
2021-04-12 00:10:40 +02:00
TIME_ZONE=UTC
2021-04-11 21:22:15 +02:00
RUN \
2021-04-12 00:10:40 +02:00
apk add --no-cache --update tzdata curl ca-certificates dumb-init && \
2021-04-11 21:22:15 +02:00
cp /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime && \
echo "${TIME_ZONE}" > /etc/timezone && date && \
2021-04-12 00:10:40 +02:00
ln -s /usr/bin/dumb-init /sbin/dinit && \
2021-04-11 21:22:15 +02:00
rm -rf /var/cache/apk/*
2021-04-12 00:10:40 +02:00
COPY init.sh /init.sh
2021-04-04 05:26:53 +02:00
COPY --from=backend /build/reproxy /srv/reproxy
RUN chmod +x /srv/reproxy
LABEL reproxy.enabled="false"
2021-04-04 05:26:53 +02:00
WORKDIR /srv
2021-04-12 00:10:40 +02:00
ENTRYPOINT ["/init.sh"]
CMD ["/srv/reproxy"]