I am unable to publish docker image to GitHub Packages.
Although I have followed the instructions found here:
https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
name: HazelCast
on:
push:
branches:
- '**'
tags:
- v*.*.*
paths:
- dev/hazelcast/**
env:
REGISTRY: ghcr.io
IMAGE_NAME: company/group/application/hazelcast
jobs:
docker:
name: Build HazelCast Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.APP_WRITE_USER }}
password: ${{ secrets.APP_WRITE_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: dev/hazelcast
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
This builds fine, and it looks like it pushed the docker image.
#8 pushing manifest for ghcr.io/company/group/application/hazelcast:master@sha256:ff4a7ebfbfbed7b76e905ed3875388cf60f6500c0b6721495efae1a7cf1238fd 1.4s done
#8 DONE 2.2s
Although the Docker image is not in GitHub packages.
I even tried to build it manually with docker command.
- name: Build docker image
run: |
docker build --no-cache \
--label org.opencontainers.image.source=https://github.com/company/application-hazelcast \
--label org.opencontainers.image.version=latest \
--label org.opencontainers.image.title=hazelcast \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ./.
docker inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
But still, it pushed the docker image, but the image is not listed in project packages.
Have you enabled write privileges for GitHub Packages? From the GH docs link you referenced:
You can also handle this when you create/modify a GHA API key.