cd into directory prior to Docker step #25877
-
Coming from GitLab CI/CD, I’m used to having a “before_script” step that CDs into my project’s “WebApplication1Core” folder (the Dockerfile is simply set up that way and I’d prefer not changing it/was having issues when I changed it). How can this be achieved in GitHub Actions? Simply adding a “run” step that did this didn’t work. The progress wasn’t retained and the Docker step was still run from the repository’s root directory.
By the time I run into the “pwd” step, the directory is already reset to the root folder. The Docker build step fails because it cannot find the Dockerfile. If I add the full path to the Docker file instead, something else breaks further down the line. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Please note that the actions/docker runner has been deprecated in favor of the run command. Since Docker is pre-installed in the virtual environment, you should be able to simply do something like:
|
Beta Was this translation helpful? Give feedback.
-
That did indeed do the trick. Thank you! |
Beta Was this translation helpful? Give feedback.
Please note that the actions/docker runner has been deprecated in favor of the run command. Since Docker is pre-installed in the virtual environment, you should be able to simply do something like: