Skip to content

Commit

Permalink
add labels to container images
Browse files Browse the repository at this point in the history
  • Loading branch information
briantist committed Sep 29, 2023
1 parent bffe509 commit f46b116
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
container-description: ${{ steps.description.outputs.container-description }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -84,6 +86,11 @@ jobs:
- name: Run container
run: docker run --rm galactory --help

- name: Extract container description
id: description
run: |
echo "container-description=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.description" }}' galactory) >> $GITHUB_OUTPUT
- name: Build arm64
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -159,9 +166,12 @@ jobs:
push: ${{ github.event_name == 'push' }}
context: .
platforms: linux/amd64,linux/arm64
labels: |
org.opencontainers.image.source=${{ github.repositoryUrl }}
tags: |
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && 'latest' || needs.test.outputs.branch }}
${{ env.UPSTREAM }}:${{ startsWith(github.ref, 'refs/tags/') && needs.test.outputs.relver || github.sha }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=${{ needs.build.outputs.container-description }}

pypi_release:
needs: [test, build]
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ RUN pip install ./galactory

FROM python:3.11-slim as final

LABEL org.opencontainers.image.title="galactory"
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
LABEL org.opencontainers.image.description="galactory: Ansible Galaxy proxy using Artifactory as a backend."

COPY --from=build /venv /venv
ENV PATH=/venv/bin:$PATH

Expand Down

0 comments on commit f46b116

Please sign in to comment.