|
1 |
| -# Cogent3 workshop Development container for cogent3 and EnsemblLite |
| 1 | +# Cogent3 Workshop Development Container for cogent3 and EnsemblLite |
2 | 2 |
|
3 |
| -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. |
| 3 | +This folder contains Docker configuration files for setting up the workshop environment for working with `cogent3` and `EnsemblLite` in a Docker container, |
| 4 | +and a `devcontainer.json` configuration so that VS Code can manage the container. The container installs the develop branch of `cogent3`, |
| 5 | +and the master branch of `EnsemblLite`. |
| 6 | +It also pre-populates VS Code extensions for Jupyter notebooks and for working with Python. |
| 7 | + |
| 8 | +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). |
| 9 | + |
| 10 | +## Choosing the Container Version |
| 11 | + |
| 12 | +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). |
| 13 | + |
| 14 | +- **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`. |
| 15 | +- **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`. |
| 16 | + |
| 17 | +### Steps to Switch Containers |
| 18 | + |
| 19 | +1. Open the `devcontainer.json` file in your editor. |
| 20 | +2. To use the default container, ensure the image is set to: |
| 21 | + ``"image": "ghcr.io/khiron/cogent3-workshop:latest"`` |
| 22 | +3. To use the prepopulated data container, change the image to: |
| 23 | + ``"image": "ghcr.io/khiron/cogent3-workshop:apes_112"`` |
| 24 | + |
| 25 | +4. Add the following `updateContentCommand` to ensure the latest image is pulled: |
| 26 | + ``"updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:latest"`` |
| 27 | + or |
| 28 | + ``"updateContentCommand": "docker pull ghcr.io/khiron/cogent3-workshop:apes_112"`` if you are pre-populating the container with data |
4 | 29 |
|
5 |
| -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). |
6 | 30 |
|
7 | 31 | ## Configuring Resource Allocation
|
8 | 32 |
|
9 |
| -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. |
| 33 | +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. |
10 | 34 |
|
11 |
| -Steps |
| 35 | +### Steps |
12 | 36 |
|
13 |
| -- Open the devcontainer.json file in your editor. |
14 |
| -- Look for the runArgs property. by default it is set to ` "runArgs": ["--cpus", "2", "-m", "4g"],`, which is 2 cpu and 4GB of RAM. |
15 |
| -- To limit the number of CPUs the container can use, add "--cpus" and your desired number of CPUs to the runArgs array. |
16 |
| -- To limit the amount of RAM the container can use, add "-m" and "4g" (or your desired amount of RAM) to the runArgs array. |
| 37 | +- Open the `devcontainer.json` file in your editor. |
| 38 | +- Look for the `runArgs` property. By default, it is set to ``"runArgs": ["--cpus", "2", "-m", "4g"],``, which allocates 2 CPUs and 4GB of RAM. |
| 39 | +- To limit the number of CPUs the container can use, add ``"--cpus"`` and your desired number of CPUs to the `runArgs` array. |
| 40 | +- 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. |
17 | 41 |
|
18 |
| -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. |
| 42 | +Please note that these settings will only limit the maximum resources a container can use. |
| 43 | +The container will use fewer resources if it doesn't need the maximum amount. |
| 44 | +Also, please ensure that your Docker host has enough resources to allocate to the container. |
| 45 | +If the host doesn't have enough resources, the container may not start. |
19 | 46 |
|
20 |
| -## Container description |
| 47 | +## Container Description |
21 | 48 |
|
22 |
| -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. |
| 49 | +This development container is designed to provide a consistent and reproducible development environment for working with the `cogent3` and `EnsemblLite` Python packages. |
| 50 | +It is based on a slim Debian image and includes a variety of tools and configurations to facilitate development. |
23 | 51 |
|
24 |
| -- Base Image: The base image is continuumIO/miniconda3 which is based on debian:bookworm-slim, a slim version of the latest Debian release. |
25 |
| -- Python: Python 3.12 is installed and set as the default Python version. |
26 |
| -- Non-root User: A non-root user named user is created for running the container. This is a good security practice. |
27 |
| -- Repositories: The cogent3 and EnsemblLite repositories are cloned into the /home/user/repos directory. |
28 |
| -- Conda Environment: A new conda environment named c312 is created with Python 3.12. This environment is activated when a new shell is started. |
29 |
| -- Packages: Flit is installed in the c312 environment |
30 |
| -- `cogent3` and `EnsemblLite`: The `cogent3` and `EnsemblLite` packages are installed from the cloned repositories in the c312 environment using flit. |
31 |
| -- 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. |
| 52 | +- **Base Image**: The base image is `continuumio/miniconda3`, which is based on `debian:bookworm-slim`, a slim version of the latest Debian release. |
| 53 | +- **Python**: Python 3.12 is installed and set as the default Python version. |
| 54 | +- **Non-root User**: A non-root user with sudo access named `user` is created in the container. |
| 55 | +- **Repositories**: The `cogent3` and `EnsemblLite` repositories are cloned into the `/home/user/repos` directory. |
| 56 | +- **Conda Environment**: A new conda environment named `c312` is created with Python 3.12. This environment is activated when a new shell is started. |
| 57 | +- **Packages**: Flit is installed in the `c312` environment. |
| 58 | +- **`cogent3` and `EnsemblLite`**: The `cogent3` and `EnsemblLite` packages are installed from the cloned repositories in the `c312` environment using flit. |
| 59 | +- **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`. |
32 | 60 |
|
33 | 61 | ## Using the Container
|
34 | 62 |
|
35 |
| -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. |
36 |
| - |
| 63 | +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. |
0 commit comments