Skip to content

Commit

Permalink
CI: More (standardized) docker image meta-data
Browse files Browse the repository at this point in the history
  • Loading branch information
hoijui committed Nov 25, 2024
1 parent 4cc48f4 commit ab321b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,42 @@ jobs:
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Prepare build meta-data
run: |
# This allows reproducible docker builds
echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
echo "GIT_VERSION=$(git describe --broken --always --tags --dirty)" >> $GITHUB_ENV
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
annotations: |
org.opencontainers.image.version=${{ env.GIT_VERSION }}
org.opencontainers.image.documentation="https://github.com/movedo/MoVeDo/blob/${{ env.GIT_VERSION }}/README.md"
org.opencontainers.image.vendor="Open Source Ecology Germany e.V."
# org.opencontainers.image.authors="Robin Vobruba <[email protected]>"
# description="This can be used as a CI base image when generating documents using MoVeDo - https://github.com/movedo/MoVeDo/"
# maintainer="Robin Vobruba <[email protected]>"
# version="1.x"
-
name: Push to Docker Hub
uses: docker/build-push-action@v6
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=true
#- name: Push to GitHub Packages
# uses: docker/build-push-action@v2
# with:
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# registry: docker.pkg.github.com
# #repository: my-org/my-repo/my-image
# repository: movedo/movedo/movedo
# tag_with_ref: true
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ RUN git config --system --add safe.directory "${CONTENT_DIR}"
# ```
ENTRYPOINT ["/bin/bash", "-c", "ln -snf /bin/bash /bin/sh && /bin/bash -c $0" ]

LABEL maintainer="Robin Vobruba <[email protected]>"
LABEL version="1.x"
LABEL description="This can be used as a CI base image when generating documents using MoVeDo - \
https://github.com/movedo/MoVeDo/"
# NOTE Labels and annotaitons are added by CI (outside this Dockerfile);
# see `.github/workflows/docker.yml`.
# This also means they will not be availabel in local builds.

0 comments on commit ab321b7

Please sign in to comment.