Skip to content

Commit 75eda7d

Browse files
committed
Add devcontainer setup
1 parent 4cd9be6 commit 75eda7d

4 files changed

Lines changed: 130 additions & 0 deletions

File tree

‎.devcontainer/Dockerfile‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:10.0
2+
3+
ARG USERNAME=vscode
4+
ARG USER_UID=1000
5+
ARG USER_GID=$USER_UID
6+
7+
RUN apt-get update && apt-get install -y --no-install-recommends \
8+
ca-certificates \
9+
curl \
10+
wget \
11+
gnupg \
12+
less \
13+
jq \
14+
unzip \
15+
procps \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Non-root user. The .NET 10 SDK image ships with a UID-1000 `app` user;
19+
# rename it to `vscode` so we have a stable, predictable account.
20+
RUN if getent passwd $USER_UID > /dev/null; then \
21+
existing_user=$(getent passwd $USER_UID | cut -d: -f1); \
22+
existing_group=$(getent group $USER_GID | cut -d: -f1); \
23+
usermod -l $USERNAME -d /home/$USERNAME -m -s /bin/bash $existing_user; \
24+
if [ -n "$existing_group" ] && [ "$existing_group" != "$USERNAME" ]; then \
25+
groupmod -n $USERNAME $existing_group; \
26+
fi; \
27+
else \
28+
groupadd --gid $USER_GID $USERNAME && \
29+
useradd --uid $USER_UID --gid $USER_GID -m -s /bin/bash $USERNAME; \
30+
fi
31+
32+
# Persistent bash history across rebuilds (matches the mount in devcontainer.json).
33+
RUN mkdir -p /commandhistory \
34+
&& touch /commandhistory/.bash_history \
35+
&& chown -R $USER_UID:$USER_GID /commandhistory \
36+
&& echo 'export HISTFILE=/commandhistory/.bash_history' >> /home/$USERNAME/.bashrc \
37+
&& echo 'export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"' >> /home/$USERNAME/.bashrc
38+
39+
USER $USERNAME
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"features": {
3+
"ghcr.io/devcontainers/features/git:1": {
4+
"version": "1.3.5",
5+
"resolved": "ghcr.io/devcontainers/features/git@sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251",
6+
"integrity": "sha256:27905dc196c01f77d6ba8709cb82eeaf330b3b108772e2f02d1cd0d826de1251"
7+
},
8+
"ghcr.io/devcontainers/features/node:2.0.0": {
9+
"version": "2.0.0",
10+
"resolved": "ghcr.io/devcontainers/features/node@sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f",
11+
"integrity": "sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f"
12+
},
13+
"ghcr.io/devcontainers/features/python:1": {
14+
"version": "1.8.0",
15+
"resolved": "ghcr.io/devcontainers/features/python@sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511",
16+
"integrity": "sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511"
17+
},
18+
"ghcr.io/va-h/devcontainers-features/uv:1": {
19+
"version": "1.1.4",
20+
"resolved": "ghcr.io/va-h/devcontainers-features/uv@sha256:a15737142539d150ef4d358e2d6a7424a0a2f3dc43b29a3aa1b50162a8b11bc1",
21+
"integrity": "sha256:a15737142539d150ef4d358e2d6a7424a0a2f3dc43b29a3aa1b50162a8b11bc1"
22+
}
23+
}
24+
}

‎.devcontainer/devcontainer.json‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "BioFSharp.INSDC",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"remoteUser": "vscode",
7+
"containerUser": "vscode",
8+
"workspaceFolder": "/workspaces/BioFSharp.INSDC",
9+
"mounts": [
10+
"source=overarc-bashhistory,target=/commandhistory,type=volume",
11+
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.claude,target=/home/vscode/.claude,type=bind,consistency=cached"
12+
],
13+
"remoteEnv": {
14+
"DOTNET_CLI_TELEMETRY_OPTOUT": "1",
15+
"DOTNET_NOLOGO": "1",
16+
"NODE_OPTIONS": "--max-old-space-size=4096",
17+
"POWERSHELL_TELEMETRY_OPTOUT": "1",
18+
"DATAHUB_TEST_URL": "${localEnv:DATAHUB_TEST_URL}",
19+
"DATAHUB_TEST_TOKEN": "${localEnv:DATAHUB_TEST_TOKEN}",
20+
"DATAHUB_TEST_PROJECT": "${localEnv:DATAHUB_TEST_PROJECT}"
21+
},
22+
"features": {
23+
"ghcr.io/devcontainers/features/node:2.0.0": {
24+
"version": "20"
25+
},
26+
"ghcr.io/devcontainers/features/python:1": {
27+
"version": "3.11",
28+
"installTools": false
29+
},
30+
"ghcr.io/devcontainers/features/git:1": {},
31+
"ghcr.io/va-h/devcontainers-features/uv:1": {}
32+
},
33+
"postCreateCommand": "bash .devcontainer/post-create.sh",
34+
"customizations": {
35+
"vscode": {
36+
"extensions": [
37+
"Ionide.Ionide-fsharp",
38+
"ms-dotnettools.csharp",
39+
"ms-python.python",
40+
"charliermarsh.ruff",
41+
"redhat.vscode-yaml",
42+
"DavidAnson.vscode-markdownlint",
43+
"anthropic.claude-code",
44+
"openai.chatgpt"
45+
],
46+
"settings": {
47+
"terminal.integrated.defaultProfile.linux": "bash",
48+
"FSharp.useSdkScripts": true
49+
}
50+
}
51+
}
52+
}

‎.devcontainer/post-create.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Runs once after the container is created. Restores project deps and installs
3+
# the opencode CLI.
4+
set -euo pipefail
5+
6+
echo "==> Restoring .NET tools"
7+
dotnet tool restore
8+
9+
echo "==> Restoring .NET dependencies"
10+
dotnet restore
11+
12+
echo "==> Installing agent CLIs globally (opencode, claude-code, codex)"
13+
npm install -g opencode-ai @anthropic-ai/claude-code @openai/codex
14+
15+
echo "==> Done."

0 commit comments

Comments
 (0)