Skip to content

Instantly share code, notes, and snippets.

@WoozyMasta
Last active February 27, 2022 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WoozyMasta/486dd57919fcb8d58f675c25942189f1 to your computer and use it in GitHub Desktop.
Save WoozyMasta/486dd57919fcb8d58f675c25942189f1 to your computer and use it in GitHub Desktop.
An example of assigning opencontainers annotations when building containers in GitLab CI
# https://github.com/opencontainers/image-spec/blob/main/annotations.md
image="$REGISTRY_DOMAIN/$CI_PROJECT_ROOT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME"
docker build \
--file ./Dockerfile --tag "$image" \
--label org.opencontainers.image.url="$image" \
--label org.opencontainers.image.vendor="$CI_PROJECT_ROOT_NAMESPACE@$CI_SERVER_HOST" \
--label org.opencontainers.image.version="$CI_COMMIT_REF_SLUG" \
--label org.opencontainers.image.description="$CI_PROJECT_TITLE" \
--label org.opencontainers.image.authors="$GITLAB_USER_EMAIL" \
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
--label org.opencontainers.image.created="$(date -uIs)Z" .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment