Search code examples
dockercachingdockerfilegithub-actionsghcr

Use ghcr in Dockerfile in GHA


I would like to use ghcr as cache to store docker image with part which almost do not change in my project (Ubuntu, miniconda and bunch of Python packages) and then use this image in Dockerfile which adds volumes and code of the project to it. Dockerfile is run by Github Actions. How could I reference to ghcr stored image in From statement of Dockerfile?


Solution

  • How could I reference to ghcr stored image in From statement of Dockerfile?

    Image references have the registry in front of them, and when not included, will default to Docker Hub. So for a registry like ghcr you want:

    FROM ghcr.io/path/to/image:tag