MY personal experiments with Docker in GitHub Action
I'm a Docker noob, so maybe this is a well known trick, but it was impossible for me to find. Hopefull it will be usefull to others. I found tons of scenarios where they need only to run the Docker in GitHub action, but no files were generated. I found tons of scenarios where they committed files from GitHub action, but no Docker was used. I found tons of scenarios where they pushed commits from Docker, but it wasn't run as GitHub action. I found tons of scenarios where they run remote Docker image, but not the local one generated by GitHub Action. No, ChatGPT doesn't know the answer, it never does. A hint towards my gole found here https://aschmelyun.com/blog/using-docker-run-inside-of-github-actions/
What I want:
- User pushes any modification (expected is
data.json
or perhap update to thescript.py
) - User reads/downloads files generated by the script.
Why I need all this: A little background explaining why need this strange artistry when a different task could be done differently.
- The user is making the modifications on phone - a computer to run the script (which would be a ton easier, yes, I realize that!) is not available.
- Installing python intepretter + the packages on the phone is also not desirable. I know it is possible, I just dont want it - it all eats too much disc space AND simple checking out on phone is also not possible via the GitHub app - the user would have to manually download the repo and unzip it to run the script, no thanks!
- Running the script directly by the GiuHub action without a Docker - done that, works ok, but slow.
How is it gonna work: From the user point of view
- In the GitHub app edit
data.json
and commit it - Wait few seconds
- Read/download or otherwise use the generated files.
From the Github point of view
- On push run action which gets cached Docker image (built earlier)
- In the docker update files from the repo (
COPY
) - Run the script to generate the files.
- Hand over the new file to the GitHub action
- GitHub action commits and pushes the new output files via the GitHubActions profile