Merge pull request #602 from strukturag/docker-version

Include "~docker" in version if built on Docker.
This commit is contained in:
Joachim Bauch 2023-11-15 12:10:09 +01:00 committed by GitHub
commit 55d143d6bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -5,7 +5,8 @@ ARG TARGETOS
WORKDIR /workdir
COPY . .
RUN apk add --no-cache bash git build-base protobuf && \
RUN touch /.dockerenv && \
apk add --no-cache bash git build-base protobuf && \
if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make proxy; else \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make proxy; fi

View file

@ -5,7 +5,8 @@ ARG TARGETOS
WORKDIR /workdir
COPY . .
RUN apk add --no-cache bash git build-base protobuf && \
RUN touch /.dockerenv && \
apk add --no-cache bash git build-base protobuf && \
if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make server; else \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make server; fi

View file

@ -15,6 +15,11 @@ if [ -z "$VERSION" ] && [ -d "$ROOT/../.git" ]; then
else
VERSION=$(git log -1 --pretty=%H)
fi
if [ -f "/.dockerenv" ]; then
VERSION="$VERSION~docker"
elif grep -sq 'docker\|lxc' /proc/1/cgroup; then
VERSION="$VERSION~docker"
fi
fi
if [ -z "$VERSION" ]; then