diff options
author | Arthur Centeno | 2021-10-25 21:04:23 +0000 |
---|---|---|
committer | Arthur Centeno | 2021-10-25 21:04:23 +0000 |
commit | 499a80f138030c4de1629c043c8f9401a99894ea (patch) | |
tree | 449dcae965d13f966fb6d52625fbc86661c8c6a0 /doc/docker-container.org | |
parent | 6151faa9ea67af4bf4ea95fb681a9dc4319474b6 (diff) | |
parent | 700802303e5e8221a9d591ba985d6607aa61e1ce (diff) | |
download | genenetwork2-499a80f138030c4de1629c043c8f9401a99894ea.tar.gz |
Merge github.com:genenetwork/genenetwork2 into acenteno
Diffstat (limited to 'doc/docker-container.org')
-rw-r--r-- | doc/docker-container.org | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/doc/docker-container.org b/doc/docker-container.org new file mode 100644 index 00000000..79b8272f --- /dev/null +++ b/doc/docker-container.org @@ -0,0 +1,82 @@ +#+TITLE: Genenetwork2 Dockerized + +* Table of Contents :TOC: +- [[#introduction][Introduction]] +- [[#creating-the-docker-images][Creating the Docker Images]] +- [[#pushing-to-dockerhub][Pushing to DockerHub]] + +* Introduction + +The CI(Continuous Integration) system for Genenetwork2 uses [[https://github.com/features/actions][Github +Actions]]. As such, it's important to have a way to run tests using +facilities provided by GUIX in a reproducible way. This project +leverages GUIX to generate a docker container from which the unittests +are ran from. + +Find instructions on how to set docker up inside GUIX [[https://github.com/pjotrp/guix-notes/blob/master/CONTAINERS.org#run-docker][here]]. This +document will not get into that. It's assumed that you have a working +docker setup. + +The rest of this document outlines how the docker container used in +the CI builds was created. + +* Creating the Docker Images + +The general idea is that GUIX is used to generate a set of binaries, +which will be added to a base mariaDB image. + +First create the gn2 tar archive by running: + +#+begin_src sh +env GUIX_PACKAGE_PATH="/home/bonface/projects/guix-bioinformatics:/home/bonface/projects/guix-past/modules" \ + ./pre-inst-env guix pack --no-grafts\ + -S /gn2-profile=/ \ + screen genenetwork2 + #+end_src + +The output will look something similar to: + +: /gnu/store/x3m77vwaqcwba24p5s4lrb7w2ii16lj9-tarball-pack.tar.gz + +Now create a folder from which will host the following dockerfile. You +can name this file Dockerfile. Note that mariadb is the base image +since it already has mariadb installed for us. + +#+begin_src conf :mkdirp yes :tangle ~/docker/Dockerfile +FROM mariadb:latest + +COPY ./gn2.tar.gz /tmp/gn2.tar.gz +RUN tar -xzf /tmp/gn2.tar.gz -C / && rm -f /tmp/gn2.tar.gz && \ + mkdir -p /usr/local/mysql /genotype_files/genotype/json +#+end_src + +Build the image(Note the fullstop at the end): + +: sudo docker build -t genenetwork2:latest -f Dockerfile . + +To load the image interactively you've just created: + +: docker run -ti "genenetwork2:latest" bash + +Assuming you have a docker instance running, you could always run +commands in it e.g: + +: docker run "genenetwork2:latest" python --version + +* Pushing to DockerHub + +We use DockerHub to store the docker images from which we use on our +CI environment using Github Actions. + +To push to dockerhub, first get the image name by running =docker +images=. Push to dockerhub using a command similar to: + +: docker push bonfacekilz/genenetwork2:latest + +Right now, we have 2 images on DockerHub: + +- https://hub.docker.com/repository/docker/bonfacekilz/python2-genenetwork2: + Contains the python2 version of gn2. Don't use this. Please use the + python3 image! +- https://hub.docker.com/repository/docker/bonfacekilz/python3-genenetwork2: + Contains the python3 version of gn2. |