Replies: 14 comments 17 replies
-
That depends on what you actually want to achieve, as in which data (or directory) do you want to share with the service container? |
Beta Was this translation helpful? Give feedback.
-
Just to add my $0.02 in the hopes that someone from github is watching: I agree that this does not currently seem to be possible, and it's a really bad limitation of the services product. An absolutely bog-standard pattern you'll see when using docker for CI work is that the docker image will look for run-time configuration files in a standard place, so that you can just mount them into the container. A more or less canonical example of this is the official Postgres docker image: the container will on startup execute any .sh or .sql files that it finds in the directory /docker-entrypoint-initdb.d -- this is commonly used to ensure that all db migrations are applied before the container starts up. Not being able to do this with GHA services really restricts their utility. :( |
Beta Was this translation helpful? Give feedback.
-
Agreed. For our use case, we need to publish pre-seeded database containers to use for non-prod environments. Typically with something like mysql we'd do this by running a mysql service while allowing |
Beta Was this translation helpful? Give feedback.
-
I have a similar use case. I am migrating a docker-compose over to service containers. All the config files for testing are in the repo and are required to be mounted into the containers. The workaround of running the containers manually along with the bridge network makes the workflow messy. Abstracting it to an action keeps it clean but I would much prefer to use the |
Beta Was this translation helpful? Give feedback.
-
I also have similar usecase. I want to perform checkout repo before I can start service container. |
Beta Was this translation helpful? Give feedback.
-
I am running into this issue now. My previous team used git-labs and this was 100% possible. It was possible with Bitbucket also. We are going to use |
Beta Was this translation helpful? Give feedback.
-
I'm surprised this is still an issue. We're also affected by this. There's all sorts of edge cases with a manual docker run like making sure you don't accidentally leak credentials, waiting for the service to be healthy, etc. |
Beta Was this translation helpful? Give feedback.
-
I've found it's actually much simpler to use a docker-compose configuration to run services, define dependencies, wait for service health, env var configuration for containers, etc. It keeps the pipeline syntax clean and offers a more familiar, less verbose and syntaxtually clean approach. |
Beta Was this translation helpful? Give feedback.
-
I've been using the following workaround to do this for a couple years now, but I can't seem to find the original link where I got the idea/syntax, which is what led me to this thread. If it helps anyone, here are my snippets. In this case, I'm using the Mosquitto MQTT service for integration tests, and want to mount configuration and password files rather than disabling authentication. The build runs in a Go container (may not be relevant):
The MQTT service container is started:
Nothing is populated yet due to lack of checkout. After checkout, the service container is restarted with this step:
Tests now proceed correctly with the mounted file(s). |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
I also just hit this and it is really really annoying. I'm simply trying to mount an nginx.conf file into nginx container. Feels like a common thing. |
Beta Was this translation helpful? Give feedback.
-
Also ran into this today |
Beta Was this translation helpful? Give feedback.
-
Run into this issue today. I tried to pass confirugration to my service, and I see it can't be done the normal way. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hello there!
I wonder if it's possible to mount a file from a repository to a service container's volume mount?
Based on the docs
But if service containers are started before actually running the action steps, how should I set this up?
Beta Was this translation helpful? Give feedback.
All reactions