1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00
reproxy/Dockerfile
Umputun 7d8802992a switch to go 1.22, update deps
update version of runners, change goveralls install

update docker build to v1.22

drop useless codeanalysis ci step
2024-03-15 17:14:08 -05:00

36 lines
962 B
Docker

FROM golang:1.22-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 --no-cache --update git tzdata ca-certificates
RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(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 ghcr.io/umputun/baseimage/app:v1.12.0 as base
FROM scratch
ENV REPROXY_IN_DOCKER=1
COPY --from=backend /build/reproxy /srv/reproxy
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=base /etc/passwd /etc/passwd
COPY --from=base /etc/group /etc/group
WORKDIR /srv
ENTRYPOINT ["/srv/reproxy"]