-
Notifications
You must be signed in to change notification settings - Fork 214
Local devcontainers enablement #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
aa6dbdd
db07194
dcc3367
d4fe3e3
21d5d6f
7ce3608
267622a
595168b
a29a5e4
56e300c
1f79ad7
5a07633
7ff6464
3488dc4
cb6169f
957ab43
460de86
f3e3bd4
8d69d56
30fcf73
e33405d
80f656a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "nextflow-training (codespaces)", | ||
|
||
// Update this to pin the release tag before release | ||
"image": "ghcr.io/nextflow-io/training:latest", | ||
// Uncomment this and comment "image" when testing Dockerfile changes | ||
// "build": { "dockerfile": "../Dockerfile", "context": ".." }, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
"workspaceFolder": "/workspaces/training", | ||
"remoteEnv": { | ||
"NXF_HOME": "/workspaces/.nextflow", | ||
"HOST_PROJECT_PATH": "/workspaces/training" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python" | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"nf-core.nf-core-extensionpack" // nf-core recommended extensions | ||
] | ||
} | ||
}, | ||
"remoteUser": "root" | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./codespaces/devcontainer.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "nextflow-training (local)", | ||
|
||
"build": { | ||
"dockerfile": "../Dockerfile", | ||
"context": "..", | ||
"options": ["--platform=linux/amd64"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really want to force people to use amd64? Is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It actually was. I got some weird Docker shim error without it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But maybe if you build the arm image it won't be needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
"workspaceFolder": "${localWorkspaceFolder}", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind", | ||
"remoteEnv": { | ||
"NXF_HOME": "/workspaces/training/.nextflow", | ||
"HOST_PROJECT_PATH": "/workspaces/training" | ||
}, | ||
"postCreateCommand": "sudo mkdir -p /workspaces && sudo rm -rf /workspaces/training && sudo ln -s ${localWorkspaceFolder} /workspaces/training", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python", | ||
"terminal.integrated.cwd": "/workspaces/training", | ||
"terminal.integrated.defaultLocation": "workspace" | ||
}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"nf-core.nf-core-extensionpack" // nf-core recommended extensions | ||
] | ||
} | ||
}, | ||
"remoteUser": "root" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Local installation using VSCode Devcontainers extension | ||
|
||
If you have a local Docker installation or are happy to install one, the easiest way to work locally with these materials is to use Visual Studio Code's devcontainer feature. This approach provides all the necessary tools and dependencies without requiring manual installation. | ||
|
||
## Requirements | ||
|
||
To use the devcontainer setup, you'll need: | ||
|
||
- [Visual Studio Code](https://code.visualstudio.com/) | ||
- A local Docker installation, for example: | ||
- [Docker Desktop](https://docs.docker.com/get-docker/) (for Windows/macOS) | ||
- [Docker Engine](https://docs.docker.com/engine/install/) (for Linux) | ||
- [Colima](https://github.com/abiosoft/colima) (alternative for macOS) | ||
- [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) (included in Docker Desktop, but may need separate installation with other Docker setups) | ||
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) for VS Code | ||
|
||
Your Docker installation must be running before you attempt to open the devcontainer. | ||
|
||
To verify that Docker buildx is available, run: | ||
|
||
```bash | ||
docker buildx version | ||
``` | ||
|
||
If this command fails, you'll need to install the buildx extension before proceeding. | ||
|
||
## Setup Instructions | ||
|
||
Follow these steps to set up your local environment using VS Code devcontainers: | ||
|
||
### Install the "Dev Containers" extension in VS Code | ||
|
||
- Open VS Code | ||
- Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X on macOS) | ||
- Search for "Dev Containers" | ||
- Click "Install" | ||
|
||
 | ||
|
||
### Clone the repository: | ||
|
||
```bash | ||
git clone https://github.com/nextflow-io/training.git | ||
cd training | ||
``` | ||
|
||
### Open the repository in VS Code: | ||
|
||
- Launch VS Code | ||
- Select **File -> Open Folder** from the menu | ||
- Navigate to and select the training repository folder you just cloned | ||
- Click **Open** | ||
|
||
### Reopen in Container | ||
|
||
When prompted by VS Code to "Reopen in Container", click on it. Alternatively: | ||
|
||
- Press F1 (or Ctrl+Shift+P / Cmd+Shift+P on macOS) | ||
- Type "Dev Containers: Reopen in Container" | ||
- **Important**: When prompted to select a configuration, choose the **local** devcontainer configuration | ||
|
||
 | ||
|
||
 | ||
|
||
Wait for the container to build. This may take a few minutes the first time as it downloads and sets up all the necessary components. | ||
|
||
Once the container is built and running, you'll have a fully configured environment with all the necessary tools installed, including: | ||
|
||
- Java | ||
- Nextflow | ||
- Docker | ||
- Git | ||
- And all other dependencies required for the training | ||
|
||
 | ||
|
||
## Benefits of Using Devcontainers | ||
|
||
Using the devcontainer approach offers several advantages: | ||
|
||
- **Consistency**: Ensures a consistent development environment across different machines | ||
- **Simplicity**: All dependencies are pre-installed and configured | ||
- **Isolation**: The development environment is isolated from your local system | ||
- **Reproducibility**: Everyone using the devcontainer gets the same setup | ||
- **No manual installation**: No need to manually install Java, Nextflow, and other tools | ||
|
||
## Checking Your Environment | ||
|
||
Once your devcontainer is running, you can verify that everything is set up correctly by running: | ||
|
||
```bash | ||
nextflow info | ||
``` | ||
|
||
This should display the Nextflow version and runtime information, confirming that your environment is properly configured. | ||
|
||
## Troubleshooting | ||
|
||
If you encounter issues with the devcontainer setup: | ||
|
||
1. Ensure your Docker installation (Docker Desktop, Colima, Docker Engine, etc.) is running before opening the devcontainer | ||
2. Check that you've selected the **local** configuration when prompted | ||
3. Verify that Docker buildx is installed and working by running `docker buildx version` | ||
4. If the container fails to build, try rebuilding it by running the "Dev Containers: Rebuild Container" command | ||
5. For persistent issues, refer to the [VS Code Dev Containers troubleshooting guide](https://code.visualstudio.com/docs/devcontainers/troubleshooting) |
Uh oh!
There was an error while loading. Please reload this page.