GitHub Codespaces - custom container

lynnlangit

Lynn Langit

Posted on September 8, 2020

GitHub Codespaces - custom container

Today's scenario was to build a learning GitHub Codespace which included some dependent files and also some associated VSCode Extensions. This is for my learn-WDL (workflow definition language for bioinformatics) lesson repo.

One challenge was that the required (cromwell) JAR file was ~200 MB, well over the max file size for Github. So I couldn't just upload the JAR file to my GitHub repo. Also I didn't want to use Github Large File Storage (or LFS) because this JAR file would be used in every command run in the Repo. So I decided to use a custom Docker container image to build this custom Codespace.


To start, I located a pre-built container image (broadinstitute\cromwell) which contained the needed dependencies (JDK and a JAR file) on DockerHub.

I tested the custom container locally and then updated the example Java DOCKERFILE in the .devcontainer folder in my Codespace to use this docker image (shown below). Take note of the location of the $HOME variable as well. I got the example Java Codespace DOCKERFILE from the Microsoft example Repo.

Alt Text

Second, I searched for VSCode extensions for this scenario (WDL Language) and found two WDL extensions available. I updated the devcontainer.json file to include these two extensions in the custom Codespace (shown below).

Alt Text

Third, I had to look around the container a bit to find the included required JAR file (cromwell.jar) - I finally found the file at the top of the container (cd /app).

I updated the .bashrc file to alias the JAR file and tested a hello.wdl file (shown below). I was able to run the test successfully!

Alt Text

💖 💪 🙅 🚩
lynnlangit
Lynn Langit

Posted on September 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related