Can I use Heroku registry as a base image for review app service?

524 Views Asked by At

One of my Heroku pipelines is currently using Docker deploys (https://devcenter.heroku.com/articles/container-registry-and-runtime) in combination with heroku.yml (https://devcenter.heroku.com/articles/heroku-yml-build-manifest).

The review apps are currently building successfully with Docker (on container stack). I currently have one web and one worker service defined in heroku.yml and in the 'formation' section of my app.json.

build:
  docker:
    web: Dockerfile.web
    worker: Dockerfile.worker
    servicex: Dockerfile.servicex

In my review app, I am also trying to run servicex which is currently an app hosted on my Heroku with Docker and container stack. Since servicex's corresponding app is using Docker, it has an image in Heroku's registry. I am trying to use that image as a base image for servicex

FROM registry.heroku.com/<app_name>/<process_type>

This will work locally since I am authenticated with Heroku's registry, but when the build happens on Heroku it fails with the error:

Sending build context to Docker daemon  5.223MBStep 1/2 : FROM registry.heroku.com/<app_name>/<process_type>
Get https://registry.heroku.com/v2/<app_name>/<process_type>/manifests/latest: no basic auth credentials

My question is if I can authenticate with Heroku's registry easily during a build? If not, what's the best way to go about this. Trying to make any credentials public, and processes from the Dockerfile don't seem to have access to Heroku config credentials.

1

There are 1 best solutions below

0
On

After speaking with Heroku support, this is not yet possible.

I decided to create a series of base images for our different language stacks, host those on Dockerhub, and use those as a starting point for my review apps' images.

I'm also using a method to cache dependencies in my Dockerfile using a similar strategy here (ruby example using bundle install https://medium.com/magnetis-backstage/how-to-cache-bundle-install-with-docker-7bed453a5800)

Since my worker and web services use the same dependencies, the dependency install step uses the cache!