Can I reference a Dockerfile instead of an image in a GitHub Actions workflow?

352 views Asked by At

Checking out the example-services repository, they set up services by referencing to images hosted, like here:

    services:
      redis:
        image: redis
        ports:
        - 6379:6379
        options: --entrypoint redis-server

We use a custom Dockerfile for Elasticsearch that's stored in the same repository as the workflow, and is not available publicly on Docker Hub. I would like to reference that Dockerfile as the service without having to push and pull from our private registry. Is this possible?

1

There are 1 answers

0
VonC On BEST ANSWER

You would need to build said image before being able to reference it. Eg: Workflow

That means using the "Build, Tag, Publish Docker", which allows to references a local Dockerfile (meaning part of your repository)

But it also implies to publish said image, which might or might not acceptable for your case.