Rendering CAMIS in Docker #286
michaelwalshe
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not sure if anyone else has had this problem, but recently I ran into some issues developing a new comparison where although everything ran fine locally (tale as old as time - works on my machine!) when it came time to create a PR the GitHub Action that tests rendering the site errored.
This led to a somewhat torturous debug cycle, where I would make some changes locally, push a commit, wait the ~11 minutes to build the site, only for it to error somewhere else 😭 . To fix this, I setup my development environment in WSL so I could effectively work in a much more similar environment. However, this can still lead to various issues with a non-reproducible environment (e.g. having an R package installed outside of the renv, which renv doesn't realise is a dependency but which is being used in the render process).
So as a more complete fix, I rewrote a Dockerfile I've used previously to setup an R/Python environment. This will create the entire environment from scratch, explicitly installing any dependencies, in a very similar way to the PR on GH actions, all without using up the allocation of free resources on GH. To further speed up the process, I've used a couple of tricks to be able to use a
renv
andpip
cache in a docker image, and I would also setfreeze: auto
in the quarto settings to not re-render previously rendered pages. This gets the total render time down to a few minutes.See below for the 3 files I added to the root directory of the project. To fully render it, you just have to run
render_docker.ps1
with PowerShell, this then creates a local site in your _site directory.I'm not advocating that this should be added to the main CAMIS repo, using Docker is a bit overkill and would likely discourage potential contributors. However, I wanted the solution I used documented somewhere here so that if anyone needs to fix bugs with the rendering process locally, they don't have to repeat the problem solving I did.
Dockerfile
render_docker.ps1
.dockerignore
Beta Was this translation helpful? Give feedback.
All reactions