Your Dockerfile needs to install keyrings.google-artifactregistry-auth
to authenticate to Artifact Registry. Modify your Dockerfile like this:
FROM python:3.12-slim
RUN apt-get update && apt-get install -y --no-install-recommends git openssh-client && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip install keyrings.google-artifactregistry-auth
RUN pip install --extra-index-url https://us-central1-python.pkg.dev/<projectid>/<pypiregistry>/simple/ my-backend==0.1.3 && pip install gunicorn
CMD ["gunicorn", "my_backend.app:app"]
This will then search for credentials for the pip
command to use. Make sure to set up proper authentication in GitHub Actions workflow to use the required credentials. You can refer to this documentation about configuring authentication to Artifact Registry.