diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 902646664..0243d9308 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -14,9 +14,24 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Gather container image tags - id: container - uses: greenbone/actions/container-image-tags@v1 + - name: Setup container meta information + id: meta + uses: docker/metadata-action@v4 + with: + images: greenbone/gvmd + labels: | + org.opencontainers.image.vendor=Greenbone + org.opencontainers.image.base.name=debian/stable-slim + flavor: latest=false # no latest container tag for git tags + tags: | + # create container tag for git tags + type=ref,event=tag + # use latest for stable branch + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} + type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} + type=raw,value=oldstable,enable=${{ github.ref == format('refs/heads/{0}', 'oldstable') }} + # use unstable for main branch + type=raw,value=unstable,enable={{is_default_branch}} - name: Login to Docker Registry uses: docker/login-action@v2 with: @@ -31,9 +46,10 @@ jobs: with: context: . push: true - tags: ${{ steps.container.outputs.image-tags }} - platforms: linux/amd64,linux/arm64 file: .docker/prod.Dockerfile + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} upload-build: name: "Upload images for building gvmd" @@ -41,17 +57,30 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Gather container image names - uses: greenbone/actions/container-image-tags@v1 - id: container + - name: Setup container meta information + id: meta + uses: docker/metadata-action@v4 with: - image-name: ${{ github.repository }}-build + images: greenbone/gvmd-build + labels: | + org.opencontainers.image.vendor=Greenbone + org.opencontainers.image.base.name=debian/stable-slim + flavor: latest=false # no latest container tag for git tags + tags: | + # create container tag for git tags + type=ref,event=tag + # use latest for stable branch + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} + type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }} + type=raw,value=oldstable,enable=${{ github.ref == format('refs/heads/{0}', 'oldstable') }} + # use unstable for main branch + type=raw,value=unstable,enable={{is_default_branch}} - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - run: echo "Build and push ${{ steps.container.outputs.image-tags }}" + - run: echo "Build and push ${{ steps.meta.outputs.tags }}" - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -61,9 +90,10 @@ jobs: with: context: . push: true - tags: ${{ steps.container.outputs.image-tags }} file: .docker/build.Dockerfile platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Trigger libtheia container build run: | curl -X POST https://api.github.com/repos/greenbone/libtheia/actions/workflows/container.yml/dispatches \