Running correct Dockerfile

I have the following:


# action.yml
name: 'Run tests'
description: 'Run tests'
  using: 'docker'
  image: '../../../tests.Dockerfile'


- name: run tests
        id: tests
        uses: ./.github/actions/tests

I also have in my repo root both a Dockerfile and tests.Dockerfile

For some reason, the above action is running Dockerfile instead of tests.Dockerfile.

How can I fix it so that it runs tests.Dockerfile?

In Docker, Dockerfile can be renamed as ‘tests.Dockerfile’ but it doesn’t work in Github action. An internal ticket is created for tracking, thanks a lot for reaching this out! :slight_smile:

As an alternative, if you would like to use two Dockerfile, please put the new one in another folder, eg: tests/Dockerfile.

Structure like below:


In workflow file, specify different action.yml directory for ‘uses’, code sample as below:

- name: Hello world action step1
uses: ./.github/actions/hello-world-action # Uses an action in the hello-world-action directory
who-to-greet: 'xman1'
- name: Hello world action step2
uses: ./ # Uses an action in the root directory
who-to-greet: 'xman2'
1 Like

Oh, good to know!

For my specific use case I ended up solving it via one multi-stage Dockerfile and build targets.

Also didn’t realize I could just call docker straight instead of writing an action :slight_smile:

But could to know this helped surface an improvement!

1 Like