1
0
mirror of https://github.com/umputun/reproxy.git synced 2025-02-16 18:34:30 +02:00

switch Dockerfile to standard base images #11 #18

This commit is contained in:
Umputun 2021-04-11 14:12:40 -05:00
parent ef09f8ace3
commit a769cc89d5

View File

@ -1,23 +1,25 @@
FROM umputun/baseimage:buildgo-latest as backend
FROM golang:1.16-alpine as backend
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG CI
ENV GOFLAGS="-mod=vendor"
ENV CGO_ENABLED=0
ADD . /build
WORKDIR /build
RUN apk add -u git
RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(/script/git-rev.sh); \
echo "runs outside of CI" && version=$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
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 umputun/baseimage:app-latest
FROM alpine:3.13
COPY --from=backend /build/reproxy /srv/reproxy
RUN chmod +x /srv/reproxy
@ -25,4 +27,3 @@ LABEL reproxy.enabled="false"
WORKDIR /srv
CMD ["/srv/reproxy"]
ENTRYPOINT ["/init-root.sh"]