In workflows, how to use ghcr docker image? #25684
-
Hi, After updating my docker image and pushing to ghcr, the changes are not available when running the workflow! The workflow looks like:
The workdir in the docker image is:
I’m still trying to figure out what’s going on, to the point where I stopped relying in the Did a lot of tests and even uploading the same image under a different name, to avoid any caching, but same issue. Locally, when I run the image, I can instantiate it and open a shell and see the binaries etc, but not once in the cloud. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
heldrida:
Could you show us exactly how the update and push happens? The way the image is used looks correct (assuming the credentials are), so it’s probably something there. |
Beta Was this translation helpful? Give feedback.
-
The Dockerfile is pushed manually to mitigate any issues:
The project requires Rust, Rustup, Cargo, etc. Which is all in the Dockerfile, as tested locally. For some reason, This step is done in the Dockerfile, as:
Which then, when I do open a shell session locally to the Docker instance, I confirm everything is ok and operates as expected:
Lists the expected files or symlink when:
Now, in the cloud, if I do the same as done locally:
The output is empty or does not have the
I understand I can have the
|
Beta Was this translation helpful? Give feedback.
-
Just thought about something that I need to test. The path I’ve been using in the Docker file is:
But I’ll now try:
And also:
Actually this wouldn’t work as effectively, $HOME throws, when running locally:
So, I guess the original should be alright:
And probably this |
Beta Was this translation helpful? Give feedback.
-
heldrida:
This right there is the problem. When using a container as a job container, the runner mounts several directories from the host into the container. So if you want your software to be available inside the job container, it really needs to go anywhere but |
Beta Was this translation helpful? Give feedback.
-
Thanks! That’s good to know, hope it helps other users. I have also tried the symlink in the Github Action workflow, but I will double check (what I meant is, during some testing, for alternative solutions). If do it as a step in the workflow, do you think it’ll work? |
Beta Was this translation helpful? Give feedback.
-
airtower-luna:
Do you know when the doc for “Initialize containers” is located? trying to find it |
Beta Was this translation helpful? Give feedback.
-
I don’t think there is a specific documentation. I mean you should check the workflow logs, where you can see the exact commands the runner is using. Here’s an example from one of my workflows: |
Beta Was this translation helpful? Give feedback.
-
Thank you for letting me know! |
Beta Was this translation helpful? Give feedback.
-
What a gem, I didn’t know that either! |
Beta Was this translation helpful? Give feedback.
This right there is the problem. When using a container as a job container, the runner mounts several directories from the host into the container.
/github/home
is one of the target directories, which hides anything you might have put there in the container image (check the “Initialize containers” step in your workflow logs).So if you want your software to be available inside the job container, it really needs to go anywhere but
/github/
inside the container image. 🙂