Skip to content

Commit

Permalink
fix Dockerfile to make proper version
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Oct 8, 2023
1 parent 048c2ce commit e410f6f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM umputun/baseimage:buildgo-latest as build-backend
ARG CI
ARG GIT_BRANCH
ARG SKIP_TEST
ARG GITHUB_SHA

ENV GOFLAGS="-mod=vendor"

Expand All @@ -20,15 +21,15 @@ RUN \

RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(/script/git-rev.sh); \
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" && \
go build -o secrets -ldflags "-X main.revision=${version} -s -w" ./app
cd app && go build -o /build/secrets.bin -ldflags "-X main.revision=${version} -s -w"


FROM umputun/baseimage:app-latest

COPY --from=build-backend /build/secrets/secrets /srv/secrets
COPY --from=build-backend /build/secrets.bin /srv/secrets
COPY --from=build-backend /build/secrets/ui/static /srv/ui/static/

WORKDIR /srv
Expand Down

0 comments on commit e410f6f

Please sign in to comment.