From d47b6f2a8832bffb6ad4b19d51b80f1d6cbb67dd Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:12:02 +1000 Subject: [PATCH 01/34] add workflows --- .devcontainer/DockerFile | 11 ++-- .devcontainer/Dockerfile.prepopulated | 17 +++++++ .devcontainer/README.md | 65 ++++++++++++++++-------- .devcontainer/devcontainer.json | 50 +++++++++--------- .github/workflows/README.md | 4 ++ .github/workflows/publish_containers.yml | 49 +++++++++--------- 6 files changed, 121 insertions(+), 75 deletions(-) create mode 100644 .devcontainer/Dockerfile.prepopulated create mode 100644 .github/workflows/README.md diff --git a/.devcontainer/DockerFile b/.devcontainer/DockerFile index b1f2da4..cfbfe91 100644 --- a/.devcontainer/DockerFile +++ b/.devcontainer/DockerFile @@ -1,7 +1,7 @@ # Use continuumio/miniconda3 as the base image FROM continuumio/miniconda3 -LABEL maintainer="Richard Morris " +LABEL maintainer="khiron " # Install required packages RUN apt-get update -q && \ @@ -43,21 +43,20 @@ RUN source /opt/conda/etc/profile.d/conda.sh && \ /opt/conda/bin/conda create -n c312 python=3.12 -y && \ conda activate c312 - # Initialize conda for zsh shell RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.zshrc && \ echo "conda activate c312" >> ~/.zshrc # Clone the repositories using SSH WORKDIR /home/user/repos -RUN git clone --branch develop https://github.com/cogent3/cogent3.git /home/$USERNAME/repos/cogent3 && \ - git clone --branch master https://github.com/cogent3/EnsemblLite.git /home/$USERNAME/repos/EnsemblLite +RUN git clone --branch develop https://github.com/cogent3/cogent3.git /home/user/repos/cogent3 && \ + git clone --branch master https://github.com/cogent3/EnsemblLite.git /home/user/repos/EnsemblLite # Install flit in the conda environment RUN source /opt/conda/etc/profile.d/conda.sh && \ conda activate c312 && \ conda install -c conda-forge flit -y - + # Install the repositories using flit RUN source /opt/conda/etc/profile.d/conda.sh && \ conda activate c312 && \ @@ -66,7 +65,7 @@ RUN source /opt/conda/etc/profile.d/conda.sh && \ cd /home/user/repos/EnsemblLite && \ flit install -s -# Start in the home directory +# Start in the home directory WORKDIR /home/user # Set zsh as the default shell for the container diff --git a/.devcontainer/Dockerfile.prepopulated b/.devcontainer/Dockerfile.prepopulated new file mode 100644 index 0000000..7187cc1 --- /dev/null +++ b/.devcontainer/Dockerfile.prepopulated @@ -0,0 +1,17 @@ +# Use the base image +FROM ghcr.io/khiron/cogent3-workshop:latest + +LABEL maintainer="khiron " + +# Populate data +USER user +WORKDIR /home/user + +RUN echo "Populating data..." && \ + mkdir /home/user/data + +# Start in the home directory +WORKDIR /home/user + +# Set zsh as the default shell for the container +CMD [ "zsh" ] diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 1f55d7e..ef1527c 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,36 +1,57 @@ -# Cogent3 workshop Development container for cogent3 and EnsemblLite +# Cogent3 Workshop Development Container for cogent3 and EnsemblLite -This folder contains a Docker configuration file for setting up the workshop environment for working with `cogent3` and `EnsemblLite` in a docker container, and a `devcontainer.json` configuration so that VS Code can manage the container. The container installs the develop branch of `cogent3`, and the master branch of `EnsemblLite`. It also pre-populates VS code extensions for jupiter notebooks and for working with python. +This folder contains Docker configuration files for setting up the workshop environment for working with `cogent3` and `EnsemblLite` in a Docker container, +and a `devcontainer.json` configuration so that VS Code can manage the container. The container installs the develop branch of `cogent3`, +and the master branch of `EnsemblLite`. +It also pre-populates VS Code extensions for Jupyter notebooks and for working with Python. -For instructions for building this docker image into a container to run the workshop, see the [Computer setup instructions](https://github.com/cogent3/Cogent3Workshop/wiki/Computer-Setup). +For instructions on building this Docker image into a container to run the workshop, see the [Computer Setup Instructions](https://github.com/cogent3/Cogent3Workshop/wiki/Computer-Setup). + +## Choosing the Container Version + +You can choose whether to have the data pre-populated in the `~/data` folder by selecting the appropriate container from the GitHub Container Registry (GHCR). + +- **Default Container**: This container does not include prepopulated data. Use the default `devcontainer.json` file with the image set to `ghcr.io/khiron/cogent3-workshop:latest`. +- **Prepopulated Data Container**: This container includes the data prepopulated in the `~/data` folder. Change the image in the `devcontainer.json` file to `ghcr.io/khiron/cogent3-workshop:prepopulated`. + +### Steps to Switch Containers + +1. Open the `devcontainer.json` file in your editor. +2. To use the default container, ensure the image is set to: + ```"image": "ghcr.io/khiron/cogent3-workshop:latest"``` +3. To use the prepopulated data container, change the image to: + ```"image": "ghcr.io/khiron/cogent3-workshop:prepopulated"``` ## Configuring Resource Allocation -You can configure the resource used for the development container by modifying the `devcontainer.json` file. This file allows you to specify the number of CPUs and the amount of RAM the container can use. +You can configure the resources used for the development container by modifying the `devcontainer.json` file. This file allows you to specify the number of CPUs and the amount of RAM the container can use. -Steps +### Steps -- Open the devcontainer.json file in your editor. -- Look for the runArgs property. by default it is set to ` "runArgs": ["--cpus", "2", "-m", "4g"],`, which is 2 cpu and 4GB of RAM. -- To limit the number of CPUs the container can use, add "--cpus" and your desired number of CPUs to the runArgs array. -- To limit the amount of RAM the container can use, add "-m" and "4g" (or your desired amount of RAM) to the runArgs array. +- Open the `devcontainer.json` file in your editor. +- Look for the `runArgs` property. By default, it is set to ``"runArgs": ["--cpus", "2", "-m", "4g"],``, which allocates 2 CPUs and 4GB of RAM. +- To limit the number of CPUs the container can use, add ``"--cpus"`` and your desired number of CPUs to the `runArgs` array. +- To limit the amount of RAM the container can use, add ``"-m"`` and your desired amount of RAM (e.g., ``"4g"``) to the `runArgs` array. -Please note that these settings will only limit the maximum resources a container can use. The container will use less resources if it doesn't need the maximum amount. Also, please make sure that your Docker host has enough resources to allocate to the container. If the host doesn't have enough resources, the container may not start. +Please note that these settings will only limit the maximum resources a container can use. +The container will use fewer resources if it doesn't need the maximum amount. +Also, please ensure that your Docker host has enough resources to allocate to the container. +If the host doesn't have enough resources, the container may not start. -## Container description +## Container Description -This development container is designed to provide a consistent and reproducible development environment for working with the `cogent3` and `EnsemblLite` Python packages. It is based on a slim Debian image and includes a variety of tools and configurations to facilitate development. +This development container is designed to provide a consistent and reproducible development environment for working with the `cogent3` and `EnsemblLite` Python packages. +It is based on a slim Debian image and includes a variety of tools and configurations to facilitate development. -- Base Image: The base image is continuumIO/miniconda3 which is based on debian:bookworm-slim, a slim version of the latest Debian release. -- Python: Python 3.12 is installed and set as the default Python version. -- Non-root User: A non-root user named user is created for running the container. This is a good security practice. -- Repositories: The cogent3 and EnsemblLite repositories are cloned into the /home/user/repos directory. -- Conda Environment: A new conda environment named c312 is created with Python 3.12. This environment is activated when a new shell is started. -- Packages: Flit is installed in the c312 environment -- `cogent3` and `EnsemblLite`: The `cogent3` and `EnsemblLite` packages are installed from the cloned repositories in the c312 environment using flit. -- Zsh and Oh My Zsh: The Zsh shell is installed and set as the default shell. Oh My Zsh is installed for additional shell features and configurations. Several plugins are enabled, including git, zsh-autosuggestions, zsh-syntax-highlighting, and autojump. +- **Base Image**: The base image is `continuumio/miniconda3`, which is based on `debian:bookworm-slim`, a slim version of the latest Debian release. +- **Python**: Python 3.12 is installed and set as the default Python version. +- **Non-root User**: A non-root user with sudo access named `user` is created in the container. +- **Repositories**: The `cogent3` and `EnsemblLite` repositories are cloned into the `/home/user/repos` directory. +- **Conda Environment**: A new conda environment named `c312` is created with Python 3.12. This environment is activated when a new shell is started. +- **Packages**: Flit is installed in the `c312` environment. +- **`cogent3` and `EnsemblLite`**: The `cogent3` and `EnsemblLite` packages are installed from the cloned repositories in the `c312` environment using flit. +- **Zsh and Oh My Zsh**: The Zsh shell is installed and set as the default shell. Oh My Zsh is installed for additional shell features and configurations. Several plugins are enabled, including `git`, `zsh-autosuggestions`, `zsh-syntax-highlighting`, and `autojump`. ## Using the Container -To use the container, you can load your clone of the workshop repository in VS-Code and you will be asked if you want to run in a devcontainer. When you select yes, VS-Code will rebuild the container, start it, remote connect into the container, and open a new VS-Code window in the container. You can then open a terminal in the container and you should automatically be in the zsh shell, in the mamba c312 environment, logged in as the user `User`, and in the directory /workspaces/$workshopname$ with the workshop files. You can navigate to the the /home/user/repos directory to access the cogent3 and EnsemblLite repositories. - +To use the container, you can load your clone of the workshop repository in VS Code and you will be asked if you want to run in a devcontainer. When you select "yes", VS Code will rebuild the container, start it, remote connect into the container, and open a new VS Code window in the container. You can then open a terminal in the container and you should automatically be in the Zsh shell, in the mamba `c312` environment, logged in as the user `user`, and in the directory `/workspaces/$workshopname$` with the workshop files. You can navigate to the `/home/user/repos` directory to access the `cogent3` and `EnsemblLite` repositories. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 154492c..c17a65d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,24 +1,28 @@ { - "name": "Cogent3 Workshop", - "build": { - "dockerfile": "Dockerfile", - "context": ".." - }, - "runArgs": ["--cpus", "2", "-m", "4g"], - " - settings": { - "terminal.integrated.defaultProfile.linux": "zsh", - "terminal.integrated.profiles.linux": { - "zsh": { - "path": "zsh" - } - }, - "python.defaultInterpreterPath": "/home/user/.conda/envs/c312/bin/python", - }, - "extensions": [ - "ms-python.python", - "ms-toolsai.jupyter" - ], - "remoteUser": "user", - "postStartCommand": "echo 'Cogent3 Workshop 2024 environment is ready!'" - } \ No newline at end of file + "name": "Cogent3 Workshop", + "image": "ghcr.io/khiron/cogent3-workshop:latest", + "runArgs": ["--cpus", "2", "-m", "4g"], + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter" + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "zsh" + } + }, + "python.defaultInterpreterPath": "/home/user/.conda/envs/c312/bin/python" + } + } + }, + "remoteUser": "user", + "postStartCommand": "chown -R user:user /home/user/.ssh && echo 'Cogent3 Workshop 2024 environment is ready!'", + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", + "source=${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached" + ] +} diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..6f5cf09 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,4 @@ +To run this workflow there has to be a secret stored named `GHCR_PAT` that contains a GitHub Personal Access Token with the following permissions set: +- read:packages + - write:packages +- delete:packages \ No newline at end of file diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 01502b1..65da18b 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -1,36 +1,37 @@ -# This is a basic workflow to help you get started with Actions +name: Build and Push Docker images -name: CI - -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the "main" branch push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + branches: + - main -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job + strategy: + matrix: + include: + - dockerfile: Dockerfile + image_tag: latest + - dockerfile: Dockerfile.prepopulated + image_tag: prepopulated + steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v2 - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_PAT }} - # Runs a set of commands using the runners shell - - name: Run a multi-line script + - name: Build Docker image run: | - echo Add other actions to build, - echo test, and deploy your project. + docker build -f .devcontainer/${{ matrix.dockerfile }} . \ + -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} + + - name: Push Docker image + run: docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} From bfb5187aad20202cc0dd2c7b5f761d93b91790ec Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:14:25 +1000 Subject: [PATCH 02/34] fir workflow in branch --- .github/workflows/publish_containers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 65da18b..ff58784 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - Build-container-images-in-workflow jobs: build: From 74c41109f617687db22aea13999840e6d73f4083 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:25:30 +1000 Subject: [PATCH 03/34] log into GHCR first --- .github/workflows/publish_containers.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index ff58784..8b0b988 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - develop - Build-container-images-in-workflow jobs: @@ -23,15 +24,11 @@ jobs: uses: actions/checkout@v2 - name: Log in to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_PAT }} + run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin - name: Build Docker image run: | - docker build -f .devcontainer/${{ matrix.dockerfile }} . \ + docker build -f .devcontainer/${{ matrix.dockerfile }} .devcontainer \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} - name: Push Docker image From ca29e6e0345b3cfc06059334d09a6da15d4e20ef Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:59:29 +1000 Subject: [PATCH 04/34] set root as the context --- .github/workflows/publish_containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 8b0b988..1bbae7e 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -28,7 +28,7 @@ jobs: - name: Build Docker image run: | - docker build -f .devcontainer/${{ matrix.dockerfile }} .devcontainer \ + docker build -f .devcontainer/${{ matrix.dockerfile }} . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} - name: Push Docker image From a683b7fbefae6e118289e08ee3ccfa2dc6dd63ec Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:02:31 +1000 Subject: [PATCH 05/34] case sensitive Dockerfile --- .devcontainer/DockerFile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/DockerFile b/.devcontainer/DockerFile index cfbfe91..7e21777 100644 --- a/.devcontainer/DockerFile +++ b/.devcontainer/DockerFile @@ -21,7 +21,7 @@ RUN useradd -m user && \ # Switch to the non-root user USER user -WORKDIR /home/user +WORKDIR /home/user # Set up zsh as the default shell SHELL ["/bin/zsh", "-c"] From 2c3b75ad97f5ed2594a59a6f8cd69cb97334a96c Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:03:21 +1000 Subject: [PATCH 06/34] renamed to force case change --- .devcontainer/{DockerFile => Dockerfile.old} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .devcontainer/{DockerFile => Dockerfile.old} (100%) diff --git a/.devcontainer/DockerFile b/.devcontainer/Dockerfile.old similarity index 100% rename from .devcontainer/DockerFile rename to .devcontainer/Dockerfile.old From b851f64467fc1c2d4fa2b337b11b8e1187074ed7 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:03:56 +1000 Subject: [PATCH 07/34] update to Pascal case --- .devcontainer/{Dockerfile.old => Dockerfile} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .devcontainer/{Dockerfile.old => Dockerfile} (100%) diff --git a/.devcontainer/Dockerfile.old b/.devcontainer/Dockerfile similarity index 100% rename from .devcontainer/Dockerfile.old rename to .devcontainer/Dockerfile From da44d6cf6c186ed5b7b10f9dddc7b24a7fd1da4a Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:08:55 +1000 Subject: [PATCH 08/34] force the base image to be built first --- .github/workflows/publish_containers.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 1bbae7e..3f36a02 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -26,10 +26,16 @@ jobs: - name: Log in to GitHub Container Registry run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin - - name: Build Docker image + - name: Build and Push Base Docker image + if: matrix.image_tag == 'latest' run: | - docker build -f .devcontainer/${{ matrix.dockerfile }} . \ - -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} + docker build -f .devcontainer/Dockerfile . \ + -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest + docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - - name: Push Docker image - run: docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:${{ matrix.image_tag }} + - name: Build and Push Prepopulated Docker image + if: matrix.image_tag == 'prepopulated' + run: | + docker build -f .devcontainer/Dockerfile.prepopulated . \ + -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated + docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated From a299f33b2f3d1bcda93ff83dedf480f89183192f Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:12:29 +1000 Subject: [PATCH 09/34] build just the base image --- .github/workflows/publish_containers.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 3f36a02..0cdf9f4 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -16,8 +16,6 @@ jobs: include: - dockerfile: Dockerfile image_tag: latest - - dockerfile: Dockerfile.prepopulated - image_tag: prepopulated steps: - name: Checkout repository @@ -33,9 +31,3 @@ jobs: -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - - name: Build and Push Prepopulated Docker image - if: matrix.image_tag == 'prepopulated' - run: | - docker build -f .devcontainer/Dockerfile.prepopulated . \ - -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated - docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated From 7f11b8e5613e03b322c7530e0a623aa8748a7bbe Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:18:06 +1000 Subject: [PATCH 10/34] add prepopulated --- .github/workflows/publish_containers.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 0cdf9f4..3f36a02 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -16,6 +16,8 @@ jobs: include: - dockerfile: Dockerfile image_tag: latest + - dockerfile: Dockerfile.prepopulated + image_tag: prepopulated steps: - name: Checkout repository @@ -31,3 +33,9 @@ jobs: -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest + - name: Build and Push Prepopulated Docker image + if: matrix.image_tag == 'prepopulated' + run: | + docker build -f .devcontainer/Dockerfile.prepopulated . \ + -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated + docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated From 88eefa2dffd81e5f9fb438d14f8b3aff239c5364 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 01:21:19 +1000 Subject: [PATCH 11/34] prevent race conditions --- .github/workflows/publish_containers.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 3f36a02..a2d70fd 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -8,17 +8,8 @@ on: - Build-container-images-in-workflow jobs: - build: + build-and-push: runs-on: ubuntu-latest - - strategy: - matrix: - include: - - dockerfile: Dockerfile - image_tag: latest - - dockerfile: Dockerfile.prepopulated - image_tag: prepopulated - steps: - name: Checkout repository uses: actions/checkout@v2 @@ -27,14 +18,12 @@ jobs: run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin - name: Build and Push Base Docker image - if: matrix.image_tag == 'latest' run: | docker build -f .devcontainer/Dockerfile . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - name: Build and Push Prepopulated Docker image - if: matrix.image_tag == 'prepopulated' run: | docker build -f .devcontainer/Dockerfile.prepopulated . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated From 8bafdcc0a96cf75b7684b6e733b0d810d3ad0f4f Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 02:06:29 +1000 Subject: [PATCH 12/34] add apse config --- data/apes_112.cfg | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 data/apes_112.cfg diff --git a/data/apes_112.cfg b/data/apes_112.cfg new file mode 100644 index 0000000..5ccda83 --- /dev/null +++ b/data/apes_112.cfg @@ -0,0 +1,17 @@ +[remote path] +host=ftp.ensembl.org +path=pub +[local path] +staging_path=apes_112/download_112 +install_path=apes_112/install_112 +[release] +release=112 +[Human] +db=core +[Chimpanzee] +db=core +[Gorilla] +db=core +[compara] +align_names=10_primates.epo +homologies= From 082d53b899328d52619def91466b9a07e8842866 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 04:47:34 +1000 Subject: [PATCH 13/34] revert to python 3.11 for EnsemblLite and do not install conflicting dev dependencies --- .devcontainer/Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7e21777..e37f353 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,6 +12,7 @@ RUN apt-get update -q && \ curl \ sudo \ openssh-client \ + time \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -38,14 +39,14 @@ RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUS # Configure zsh RUN sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc -# Create a new conda environment with Python 3.12 +# Create a new conda environment with Python 3.11 RUN source /opt/conda/etc/profile.d/conda.sh && \ - /opt/conda/bin/conda create -n c312 python=3.12 -y && \ - conda activate c312 + /opt/conda/bin/conda create -n c311 python=3.11 -y && \ + conda activate c311 # Initialize conda for zsh shell RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.zshrc && \ - echo "conda activate c312" >> ~/.zshrc + echo "conda activate c311" >> ~/.zshrc # Clone the repositories using SSH WORKDIR /home/user/repos @@ -54,16 +55,16 @@ RUN git clone --branch develop https://github.com/cogent3/cogent3.git /home/user # Install flit in the conda environment RUN source /opt/conda/etc/profile.d/conda.sh && \ - conda activate c312 && \ + conda activate c311 && \ conda install -c conda-forge flit -y -# Install the repositories using flit +# Install the repositories using flit --deps production to avoid dev dependencies that conflict (black/isort/click) RUN source /opt/conda/etc/profile.d/conda.sh && \ - conda activate c312 && \ + conda activate c311 && \ cd /home/user/repos/cogent3 && \ - flit install -s && \ + flit install --deps production -s && \ cd /home/user/repos/EnsemblLite && \ - flit install -s + flit install --deps production -s # Start in the home directory WORKDIR /home/user From 33a606172efa52b67f0d3f5dbd4bd4e130736490 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 04:58:47 +1000 Subject: [PATCH 14/34] rename image prepopulated to apes_112 --- .../{Dockerfile.prepopulated => Dockerfile.apes_112} | 6 +++++- .devcontainer/README.md | 4 ++-- .github/workflows/publish_containers.yml | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) rename .devcontainer/{Dockerfile.prepopulated => Dockerfile.apes_112} (51%) diff --git a/.devcontainer/Dockerfile.prepopulated b/.devcontainer/Dockerfile.apes_112 similarity index 51% rename from .devcontainer/Dockerfile.prepopulated rename to .devcontainer/Dockerfile.apes_112 index 7187cc1..01245d1 100644 --- a/.devcontainer/Dockerfile.prepopulated +++ b/.devcontainer/Dockerfile.apes_112 @@ -8,7 +8,11 @@ USER user WORKDIR /home/user RUN echo "Populating data..." && \ - mkdir /home/user/data + mkdir /home/user/data && \ + cp /workspaces/SMBE2024WORKSHOP/data/apes_112.cfg /home/user/data && \ + cd /home/user/data + # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl + # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl # Start in the home directory WORKDIR /home/user diff --git a/.devcontainer/README.md b/.devcontainer/README.md index ef1527c..2397a2a 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -12,7 +12,7 @@ For instructions on building this Docker image into a container to run the works You can choose whether to have the data pre-populated in the `~/data` folder by selecting the appropriate container from the GitHub Container Registry (GHCR). - **Default Container**: This container does not include prepopulated data. Use the default `devcontainer.json` file with the image set to `ghcr.io/khiron/cogent3-workshop:latest`. -- **Prepopulated Data Container**: This container includes the data prepopulated in the `~/data` folder. Change the image in the `devcontainer.json` file to `ghcr.io/khiron/cogent3-workshop:prepopulated`. +- **Container prepopulated with apes_112**: This container includes the data prepopulated in the `~/data` folder. Change the image in the `devcontainer.json` file to `ghcr.io/khiron/cogent3-workshop:apes_112`. ### Steps to Switch Containers @@ -20,7 +20,7 @@ You can choose whether to have the data pre-populated in the `~/data` folder by 2. To use the default container, ensure the image is set to: ```"image": "ghcr.io/khiron/cogent3-workshop:latest"``` 3. To use the prepopulated data container, change the image to: - ```"image": "ghcr.io/khiron/cogent3-workshop:prepopulated"``` + ```"image": "ghcr.io/khiron/cogent3-workshop:apes_112"``` ## Configuring Resource Allocation diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index a2d70fd..259596a 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -23,8 +23,8 @@ jobs: -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - - name: Build and Push Prepopulated Docker image + - name: Build and Push Docker image prepopulated with apes_112 run: | - docker build -f .devcontainer/Dockerfile.prepopulated . \ - -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated - docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:prepopulated + docker build -f .devcontainer/Dockerfile.apes_112 . \ + -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 + docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 From 3ec76cdb131495d1d48f705178e8340c31a1abb6 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:13:41 +1000 Subject: [PATCH 15/34] force a refresh of the image from GHCR --- .devcontainer/Dockerfile.apes_112 | 2 +- .devcontainer/README.md | 10 ++++++++-- .devcontainer/devcontainer.json | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 01245d1..ea0eff5 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -9,7 +9,7 @@ WORKDIR /home/user RUN echo "Populating data..." && \ mkdir /home/user/data && \ - cp /workspaces/SMBE2024WORKSHOP/data/apes_112.cfg /home/user/data && \ + cp /workspaces/SMBE2024Workshop/data/apes_112.cfg /home/user/data/ && \ cd /home/user/data # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 2397a2a..f4d0982 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -18,9 +18,15 @@ You can choose whether to have the data pre-populated in the `~/data` folder by 1. Open the `devcontainer.json` file in your editor. 2. To use the default container, ensure the image is set to: - ```"image": "ghcr.io/khiron/cogent3-workshop:latest"``` + ``"image": "ghcr.io/khiron/cogent3-workshop:latest"`` 3. To use the prepopulated data container, change the image to: - ```"image": "ghcr.io/khiron/cogent3-workshop:apes_112"``` + ``"image": "ghcr.io/khiron/cogent3-workshop:apes_112"`` + +4. Add the following `updateContentCommand` to ensure the latest image is pulled: + ``"updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:latest"`` + or + ``"updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:apes_112"`` if you are pre-populating the container with data + ## Configuring Resource Allocation diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c17a65d..5ab46d3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,5 +24,7 @@ "mounts": [ "source=${localEnv:HOME}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", "source=${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached" - ] + ], + "updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:latest" + } From 492a4b93c6259c1584aa79b4902eb21362eea4ea Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:26:30 +1000 Subject: [PATCH 16/34] copy apes_112.cfg relative to the local context --- .devcontainer/Dockerfile.apes_112 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index ea0eff5..c09b463 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -9,7 +9,7 @@ WORKDIR /home/user RUN echo "Populating data..." && \ mkdir /home/user/data && \ - cp /workspaces/SMBE2024Workshop/data/apes_112.cfg /home/user/data/ && \ + cp /data/apes_112.cfg /home/user/data/ && \ cd /home/user/data # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl From a93dd5259ded7b93a726788637a0de21c67f6183 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:30:06 +1000 Subject: [PATCH 17/34] data is not necessarily in the root --- .devcontainer/Dockerfile.apes_112 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index c09b463..bf36e1e 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -9,7 +9,7 @@ WORKDIR /home/user RUN echo "Populating data..." && \ mkdir /home/user/data && \ - cp /data/apes_112.cfg /home/user/data/ && \ + cp data/apes_112.cfg /home/user/data/ && \ cd /home/user/data # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl From 15715a61a729093e632a99df3cf01e5e6a486aeb Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:39:59 +1000 Subject: [PATCH 18/34] pwd to find out where we are --- .devcontainer/Dockerfile.apes_112 | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index bf36e1e..1f59ea0 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -8,6 +8,7 @@ USER user WORKDIR /home/user RUN echo "Populating data..." && \ + pwd && \ mkdir /home/user/data && \ cp data/apes_112.cfg /home/user/data/ && \ cd /home/user/data From dccb968d4fe115c157a96a893a0e588d0018a0f9 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:45:38 +1000 Subject: [PATCH 19/34] set the workdir at the end of the process --- .devcontainer/Dockerfile.apes_112 | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 1f59ea0..f2bb7c1 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -5,7 +5,6 @@ LABEL maintainer="khiron " # Populate data USER user -WORKDIR /home/user RUN echo "Populating data..." && \ pwd && \ From 73ddf7863b224dbe4f60c19d639b2ee44ee02232 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 05:56:42 +1000 Subject: [PATCH 20/34] copy the cfg filr to the ~/data folder --- .devcontainer/Dockerfile.apes_112 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index f2bb7c1..5b00dcd 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -6,10 +6,13 @@ LABEL maintainer="khiron " # Populate data USER user +# Ensure the data directory exists +RUN mkdir -p /home/user/data + +# copy the config from the build context into the user data folder +COPY data/apes_112.cfg /home/user/data/ + RUN echo "Populating data..." && \ - pwd && \ - mkdir /home/user/data && \ - cp data/apes_112.cfg /home/user/data/ && \ cd /home/user/data # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl From 9ff9fdcb6d3b0c00f301f544d1de7487bc92fb2e Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 07:43:46 +1000 Subject: [PATCH 21/34] fix default python interpreter to 3.11 and update conda --- .devcontainer/Dockerfile | 2 ++ .devcontainer/devcontainer.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e37f353..4c0b3c5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,6 +3,8 @@ FROM continuumio/miniconda3 LABEL maintainer="khiron " +RUN conda update --all + # Install required packages RUN apt-get update -q && \ apt-get install -q -y --no-install-recommends \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5ab46d3..226ba5a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,7 +15,7 @@ "path": "zsh" } }, - "python.defaultInterpreterPath": "/home/user/.conda/envs/c312/bin/python" + "python.defaultInterpreterPath": "/home/user/.conda/envs/c311/bin/python" } } }, From 1a785aec798eb8be2a3b717feb39511e7c3e07dc Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 08:09:02 +1000 Subject: [PATCH 22/34] change ensebml to develop branch and go back to python 3.12 --- .devcontainer/Dockerfile | 14 +++++++------- .devcontainer/devcontainer.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4c0b3c5..c03010e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -41,28 +41,28 @@ RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUS # Configure zsh RUN sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc -# Create a new conda environment with Python 3.11 +# Create a new conda environment with Python 3.12 RUN source /opt/conda/etc/profile.d/conda.sh && \ - /opt/conda/bin/conda create -n c311 python=3.11 -y && \ - conda activate c311 + /opt/conda/bin/conda create -n c312 python=3.12 -y && \ + conda activate c312 # Initialize conda for zsh shell RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> ~/.zshrc && \ - echo "conda activate c311" >> ~/.zshrc + echo "conda activate c312" >> ~/.zshrc # Clone the repositories using SSH WORKDIR /home/user/repos RUN git clone --branch develop https://github.com/cogent3/cogent3.git /home/user/repos/cogent3 && \ - git clone --branch master https://github.com/cogent3/EnsemblLite.git /home/user/repos/EnsemblLite + git clone --branch develop https://github.com/cogent3/EnsemblLite.git /home/user/repos/EnsemblLite # Install flit in the conda environment RUN source /opt/conda/etc/profile.d/conda.sh && \ - conda activate c311 && \ + conda activate c312 && \ conda install -c conda-forge flit -y # Install the repositories using flit --deps production to avoid dev dependencies that conflict (black/isort/click) RUN source /opt/conda/etc/profile.d/conda.sh && \ - conda activate c311 && \ + conda activate c312 && \ cd /home/user/repos/cogent3 && \ flit install --deps production -s && \ cd /home/user/repos/EnsemblLite && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 226ba5a..5ab46d3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,7 +15,7 @@ "path": "zsh" } }, - "python.defaultInterpreterPath": "/home/user/.conda/envs/c311/bin/python" + "python.defaultInterpreterPath": "/home/user/.conda/envs/c312/bin/python" } } }, From 927289345c8345cad3a2b77fbb5d087ec059fc54 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 08:51:00 +1000 Subject: [PATCH 23/34] determine how many procs are available to a workflow and set the container to build using 2 --- .devcontainer/Dockerfile.apes_112 | 7 ++++--- .github/workflows/count_procs.yml | 11 +++++++++++ .github/workflows/publish_containers.yml | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/count_procs.yml diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 5b00dcd..8ada558 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -13,9 +13,10 @@ RUN mkdir -p /home/user/data COPY data/apes_112.cfg /home/user/data/ RUN echo "Populating data..." && \ - cd /home/user/data - # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl - # /usr/bin/time -v ensembl_cli download -c apes_112.cfg -d ensembl + cd /home/user/data && \ + /usr/bin/time -v elt download -c apes_112.cfg && \ + /usr/bin/time -v elt install -d apes_112/download_112 -np 2 -f && \ + /usr/bin/time -v elt homologs -i apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 # Start in the home directory WORKDIR /home/user diff --git a/.github/workflows/count_procs.yml b/.github/workflows/count_procs.yml new file mode 100644 index 0000000..1a4dbe6 --- /dev/null +++ b/.github/workflows/count_procs.yml @@ -0,0 +1,11 @@ +jobs: + check-cpus: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Check number of CPUs + run: | + echo "Number of CPUs available:" + nproc diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 259596a..124dfe1 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -19,12 +19,12 @@ jobs: - name: Build and Push Base Docker image run: | - docker build -f .devcontainer/Dockerfile . \ + docker build --cpus 2 -f .devcontainer/Dockerfile . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - name: Build and Push Docker image prepopulated with apes_112 run: | - docker build -f .devcontainer/Dockerfile.apes_112 . \ + docker build --cpus 2 -f .devcontainer/Dockerfile.apes_112 . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 From 130f59391c223fdcb156308fc30ae08320abf2ba Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 08:55:58 +1000 Subject: [PATCH 24/34] use 2 cpus --- .github/workflows/count_procs.yml | 11 ----------- .github/workflows/publish_containers.yml | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 .github/workflows/count_procs.yml diff --git a/.github/workflows/count_procs.yml b/.github/workflows/count_procs.yml deleted file mode 100644 index 1a4dbe6..0000000 --- a/.github/workflows/count_procs.yml +++ /dev/null @@ -1,11 +0,0 @@ -jobs: - check-cpus: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Check number of CPUs - run: | - echo "Number of CPUs available:" - nproc diff --git a/.github/workflows/publish_containers.yml b/.github/workflows/publish_containers.yml index 124dfe1..259596a 100644 --- a/.github/workflows/publish_containers.yml +++ b/.github/workflows/publish_containers.yml @@ -19,12 +19,12 @@ jobs: - name: Build and Push Base Docker image run: | - docker build --cpus 2 -f .devcontainer/Dockerfile . \ + docker build -f .devcontainer/Dockerfile . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:latest - name: Build and Push Docker image prepopulated with apes_112 run: | - docker build --cpus 2 -f .devcontainer/Dockerfile.apes_112 . \ + docker build -f .devcontainer/Dockerfile.apes_112 . \ -t ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 docker push ghcr.io/${{ github.repository_owner }}/cogent3-workshop:apes_112 From 1e74fc503e539c50ff44d49db419d72271062a0e Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:06:09 +1000 Subject: [PATCH 25/34] disable processing of apes_112 to make sur ethe container has teh cfg file copied --- .devcontainer/Dockerfile.apes_112 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 8ada558..c82672a 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -12,11 +12,11 @@ RUN mkdir -p /home/user/data # copy the config from the build context into the user data folder COPY data/apes_112.cfg /home/user/data/ -RUN echo "Populating data..." && \ - cd /home/user/data && \ - /usr/bin/time -v elt download -c apes_112.cfg && \ - /usr/bin/time -v elt install -d apes_112/download_112 -np 2 -f && \ - /usr/bin/time -v elt homologs -i apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 +# RUN echo "Populating data..." && \ +# cd /home/user/data && \ +# /usr/bin/time -v elt download -c apes_112.cfg && \ +# /usr/bin/time -v elt install -d apes_112/download_112 -np 2 -f && \ +# /usr/bin/time -v elt homologs -i apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 # Start in the home directory WORKDIR /home/user From 6549f61537c52f8b5c75bce195401734db945d48 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Tue, 18 Jun 2024 06:10:36 +1000 Subject: [PATCH 26/34] add workshop mount to ~ and explicitly locate data files for apes_112 --- .devcontainer/Dockerfile.apes_112 | 9 ++++----- .devcontainer/devcontainer.json | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index c82672a..caa0dfd 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -12,11 +12,10 @@ RUN mkdir -p /home/user/data # copy the config from the build context into the user data folder COPY data/apes_112.cfg /home/user/data/ -# RUN echo "Populating data..." && \ -# cd /home/user/data && \ -# /usr/bin/time -v elt download -c apes_112.cfg && \ -# /usr/bin/time -v elt install -d apes_112/download_112 -np 2 -f && \ -# /usr/bin/time -v elt homologs -i apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 +RUN echo "Populating data..." && \ + /usr/bin/time -v elt download -c /home/user/data/apes_112.cfg && \ + /usr/bin/time -v elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ + /usr/bin/time -v elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 # Start in the home directory WORKDIR /home/user diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5ab46d3..41b8395 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,11 +20,12 @@ } }, "remoteUser": "user", + "workspaceFolder": "/home/user/workshop", "postStartCommand": "chown -R user:user /home/user/.ssh && echo 'Cogent3 Workshop 2024 environment is ready!'", "mounts": [ "source=${localEnv:HOME}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", - "source=${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached" + "source=${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", + "source=${localWorkspaceFolder},target=/home/user/workshop,type=bind,consistency=cached" ], "updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:latest" - } From 328d18af64e4a838635d8bc26f56d43423a4055f Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Tue, 18 Jun 2024 07:58:21 +1000 Subject: [PATCH 27/34] concatenate both home environment variable so this works with mac.linux&windows --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 41b8395..3f8b099 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,8 +23,7 @@ "workspaceFolder": "/home/user/workshop", "postStartCommand": "chown -R user:user /home/user/.ssh && echo 'Cogent3 Workshop 2024 environment is ready!'", "mounts": [ - "source=${localEnv:HOME}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", - "source=${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/user/.ssh,type=bind,consistency=cached", "source=${localWorkspaceFolder},target=/home/user/workshop,type=bind,consistency=cached" ], "updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:latest" From 38227ba5351d8d75d0545b62d53474ff7c4a6bd9 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:05:03 +1000 Subject: [PATCH 28/34] make sure to activate conda before running elt --- .devcontainer/Dockerfile.apes_112 | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index caa0dfd..4d1a4bf 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -13,6 +13,7 @@ RUN mkdir -p /home/user/data COPY data/apes_112.cfg /home/user/data/ RUN echo "Populating data..." && \ + conda activate c312 && \ /usr/bin/time -v elt download -c /home/user/data/apes_112.cfg && \ /usr/bin/time -v elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ /usr/bin/time -v elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 From 4d61e815a7befd556825b50ae5df8a0dc5c4da19 Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:09:19 +1000 Subject: [PATCH 29/34] initialize conda in the apes_112 dockerfile --- .devcontainer/Dockerfile.apes_112 | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 4d1a4bf..9ac7256 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -13,6 +13,7 @@ RUN mkdir -p /home/user/data COPY data/apes_112.cfg /home/user/data/ RUN echo "Populating data..." && \ + conda init && \ conda activate c312 && \ /usr/bin/time -v elt download -c /home/user/data/apes_112.cfg && \ /usr/bin/time -v elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ From 4117386d33c160c75396c5fb46fa46b4a19205ea Mon Sep 17 00:00:00 2001 From: richard morris <1835007+khiron@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:13:38 +1000 Subject: [PATCH 30/34] fully specify path to elt --- .devcontainer/Dockerfile.apes_112 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 9ac7256..165ac91 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -13,11 +13,9 @@ RUN mkdir -p /home/user/data COPY data/apes_112.cfg /home/user/data/ RUN echo "Populating data..." && \ - conda init && \ - conda activate c312 && \ - /usr/bin/time -v elt download -c /home/user/data/apes_112.cfg && \ - /usr/bin/time -v elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ - /usr/bin/time -v elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 + /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt download -c /home/user/data/apes_112.cfg && \ + /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ + /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 # Start in the home directory WORKDIR /home/user From 334263169dd032980d0c5098b6c6f2eb397157ea Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 19 Jun 2024 11:16:43 +1000 Subject: [PATCH 31/34] copy the data directory to the base container --- .devcontainer/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c03010e..b7b6afa 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -71,5 +71,8 @@ RUN source /opt/conda/etc/profile.d/conda.sh && \ # Start in the home directory WORKDIR /home/user +# copy the data directory to ~/data +COPY data /home/user/data + # Set zsh as the default shell for the container CMD [ "zsh" ] From 2cf911349a439cbd865a7d34afd468aca0a9615f Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 19 Jun 2024 11:33:00 +1000 Subject: [PATCH 32/34] set user as owner of ~/data --- .devcontainer/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b7b6afa..5d3c54d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -74,5 +74,8 @@ WORKDIR /home/user # copy the data directory to ~/data COPY data /home/user/data +# set ownership of ~/data to user +run chown -R user:user /home/user/ + # Set zsh as the default shell for the container CMD [ "zsh" ] From 64df45e15ddbfa4ad57ff1f79850eabf6fc2ba22 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 19 Jun 2024 11:35:54 +1000 Subject: [PATCH 33/34] comment out install and sample of data --- .devcontainer/Dockerfile.apes_112 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile.apes_112 b/.devcontainer/Dockerfile.apes_112 index 165ac91..1b8f3fa 100644 --- a/.devcontainer/Dockerfile.apes_112 +++ b/.devcontainer/Dockerfile.apes_112 @@ -13,9 +13,10 @@ RUN mkdir -p /home/user/data COPY data/apes_112.cfg /home/user/data/ RUN echo "Populating data..." && \ - /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt download -c /home/user/data/apes_112.cfg && \ - /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ - /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 + /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt download -c /home/user/data/apes_112.cfg + # && \ + # /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt install -d /home/user/data/apes_112/download_112 -np 2 -f && \ + # /usr/bin/time -v /home/user/.conda/envs/c312/bin/elt homologs -i /home/user/data/apes_112/install_112 --ref human --limit 20 -np 2 -o sampled-20 # Start in the home directory WORKDIR /home/user From 94ee0ec479ed3ce4f4015d3f28474259b15d32b4 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 19 Jun 2024 11:40:35 +1000 Subject: [PATCH 34/34] chown needed sudo --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5d3c54d..ecf4316 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -75,7 +75,7 @@ WORKDIR /home/user COPY data /home/user/data # set ownership of ~/data to user -run chown -R user:user /home/user/ +RUN sudo chown -R user:user /home/user/ # Set zsh as the default shell for the container CMD [ "zsh" ]