Closed Valentin-Metz closed 8 months ago
@Valentin-Metz I know next to nothing about Docker so I have to rely on other's suggestions. Mind taking a look at this old PR that was rejected and letting me know how those comment relate to this PR?
@Valentin-Metz I know next to nothing about Docker so I have to rely on other's suggestions. Mind taking a look at this old PR that was rejected and letting me know how those comment relate to this PR?
9
This should be exactly what the #9 people intended (but with more modern tools). Additionally nothing in here will affect the "outside/normal" operation of the program/repository. Everything is boxed into the Dockerfile and the corresponding GitHub action.
Thanks for the explanation. #109 didn't get merged, partly because of the following comment. What do your thoughts of docker hub?
Why not just upload that image to dockerhub? That way the script could be executed as (say) docker run canismarko/dungeon-sheets character=warlock
No need to even download the repository!
Thanks for the explanation. #109 didn't get merged, partly because of the following comment. What do your thoughts of docker hub?
Why not just upload that image to dockerhub? That way the script could be executed as (say) docker run canismarko/dungeon-sheets character=warlock No need to even download the repository!
We solve exactly this.
Think of a "docker image" as a virtual machine snapshot.
A Dockerfile
provides the instructions on how to "compile" that VM from scratch.
Any user can call docker build .
in a directory and build that machine from scratch after cloning the repository.
Dockerhub is a platform where you can upload these virtual machines, so that users can download and use them directly, without the need for even cloning the repository or building the VM.
Previously, you'd have to manually compile the VM and upload the compiled VM there for people to use.
As GitHub expanded its action profile, it now allows us to use the GitHub servers to compile this VM for us, and GitHub will also handle the publishing. Instead of users downloading from Dockerhub (that's what the docker run canismarko/dungeon-sheets
command would do, it'd search for an image from the user canismarko
named dungeon-sheets
on Dockerhub), they'll be able to download it from GitHub instead.
After the attached GitHub action executes for the first time, your repository page will gain a new link on the right hand side called "Packages" (directly under "Releases").
Users can then specify docker run -it -v $(pwd):/build ghcr.io/canismarko/dungeon-sheets:master
(this is also the command I've written into the readme file), where instead of Dockerhub, their Docker daemon will now search for the image on ghcr.io
(GitHub container registry) from user canismarko
, project dungeon-sheets
, image compiled from master
branch.
Alright, I'm going to merge this and see what happens. Thanks @Valentin-Metz
Alright, I'm going to merge this and see what happens. Thanks @Valentin-Metz
Excellent!
You can now simply run docker run -it -v $(pwd):/build ghcr.io/canismarko/dungeon-sheets:master
in any directory with valid character.py
files in it. Docker will magically take care of the rest and build the characters in that folder with just one command.
I've added a
Dockerfile
and the according action to build and publish the image as part of the repository. Any user can nowdocker run -it -v $(pwd):/build ghcr.io/canismarko/dungeon-sheets:master
and it'll build all sheets in the current directory. Custom arguments can be passed at the end of the command. Current default arguments are:CMD [ "--fancy", "--editable", "--recursive" ]
DND-5e-LaTeX-Template included; no install required; no opportunity for dependency conflicts.I've also done a few additional minor changes:
Suggested future improvements: I've noticed that there are a few
FutureWarning
related toDocutils
when building with python 3.12, as well as someSyntaxWarning
messages. They don't seem to impact anything, but they should probably be dealt with eventually. I'm unfamiliar with the code sections these occur in, so it's probably best if you take a look. They are unrelated to any changes in this pull request; they simply surface due to its use of the latest python version.