Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Using Dockerfile from different repo as container

Is there a way to use a Dockerfile from a different repository as the image for an action i'm running? Let's say I have 2 repos - me/app and me/dockerfiles - both are private. I can access the 2nd repo using a token, but I'm assuming i'd need to do this in 2 steps and then perist the data between them (as artefacts maybe)

 

I want to do something like this:

 

name: Test
on:
push:

jobs:
SETUP:
name: Setup
runs-on: ubuntu-latest

steps:
- name: Checkout dockerfiles
uses: actions/checkout@master
with:
repository: me/dockerfiles
token: ${{ secrets.GITHUB_ACTIONS_ACCESS_TOKEN }}

TEST:
name: Test
runs-on: ubuntu-latest
container:
image: '/home/runner/work/me/dockerfiles/versionx/Dockerfile'

 

At the moment the data isn't persisted anyway, but i'm not sure it's possible to make it available before it's needed since the step to download would need to be after the step where the image is declared.

 

Is this possible?

1 Reply
GitHub Partner
Message 2 of 2

Re: Using Dockerfile from different repo as container

When use jobs.<job_id>.container.image The value can be the Docker Hub image name or a public docker registry name.  Using Dockerfile from different repo as container is not supported. 

You could build your dockerfile and then push the image to Docker Hub .  

Or you could consider to create a docker container action, what I need to prompt is that When an action is in a private repository, the action can only be used in workflows in the same repository. Public actions can be used by workflows in any repository.