Skip to content

feat: add devcontainer #19

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "Snakemake-Tutorial",
"build": {
"context": "..",
"dockerfile": "../Dockerfile"
},
"postCreateCommand": "bash .devcontainer/setup.bash"
}
14 changes: 14 additions & 0 deletions .devcontainer/setup.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# abort on error, undefined vars, and failed pipelines
set -euo pipefail

rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Don’t rm -rf the directory you are executing from

rm -rf .devcontainer deletes the folder that contains this very script while it is still running.
Although the inode stays open, this is brittle and may break future re-runs or tooling that expects .devcontainer to exist after setup. Remove only the obsolete sub-artifacts instead.

-rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
+rm -f Dockerfile .gitpod.yml && rm -rf .github
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
rm -f Dockerfile .gitpod.yml && rm -rf .github
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at line 5, avoid removing the entire .devcontainer
directory since it contains the running script. Instead of `rm -rf
.devcontainer`, modify the command to only delete obsolete sub-artifacts inside
.devcontainer, preserving the directory itself to prevent breaking future runs
or tooling that relies on its existence.

echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
echo "*" > .gitignore
Comment on lines +6 to +7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Overwrites & then hides almost everything
README.md is overwritten unconditionally and the subsequent
echo "*" ignores all new files—including the freshly written README.md—so the user ends up with a repository that only tracks .gitignore itself.

Consider either:

  1. Guarding creation ([ -e README.md ] || …) and using a narrower ignore pattern, or
  2. Adding explicit negations for the few files you do want under version control.

Example:

-echo "*" > .gitignore
+cat > .gitignore <<'EOF'
+*
+!*.md
+!.devcontainer/**
+EOF
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
echo "*" > .gitignore
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
cat > .gitignore <<'EOF'
*
!*.md
!.devcontainer/**
EOF
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at lines 6-7, the script overwrites README.md
unconditionally and then writes "*" to .gitignore, which causes all files
including README.md to be ignored. To fix this, modify the script to check if
README.md exists before creating it, and update .gitignore to use a narrower
pattern or add explicit negations to ensure README.md and other important files
are not ignored.

conda init
set +u
source ~/.bashrc
set -u

echo 'conda activate snakemake-tutorial' >> ~/.bashrc
echo "Setup done"