Skip to content

Commit

Permalink
Merge pull request #405 from Kegbot/mikey/tag-builds
Browse files Browse the repository at this point in the history
tag docker builds with build information
  • Loading branch information
mik3y authored May 1, 2020
2 parents 2d6b998 + 903794f commit 017323c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ jobs:
-
name: Checkout
uses: actions/checkout@v2
-
name: Prepare
id: prepare
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=version::${TAG%-*}
else
echo ::set-output name=version::snapshot
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-
name: Set up Docker Buildx
id: buildx
Expand All @@ -29,6 +41,9 @@ jobs:
run: |
docker buildx build \
--platform linux/amd64,linux/arm/v7 \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "GIT_SHORT_SHA=${GITHUB_SHA::8}" \
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
-t current \
--load .
-
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ ADD setup.py ./
RUN python setup.py develop
RUN bin/kegbot collectstatic -v 0 --noinput

ARG GIT_SHORT_SHA="unknown"
ARG VERSION="unknown"
ARG BUILD_DATE="unknown"
RUN echo "GIT_SHORT_SHA=${GIT_SHORT_SHA}" > /etc/kegbot-version
RUN echo "VERSION=${VERSION}" >> /etc/kegbot-version
RUN echo "BUILD_DATE=${BUILD_DATE}" >> /etc/kegbot-version

VOLUME ["/kegbot-data"]

EXPOSE 8000
Expand Down

0 comments on commit 017323c

Please sign in to comment.