Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Chore: improve dev containers

Jonathan ARNAULTa87278af67df
diff --git a/.devcontainer/.mnt-ms-playwright-cache/.gitkeep b/.devcontainer/.mnt-ms-playwright-cache/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/.devcontainer/.mnt-node_modules/.gitkeep b/.devcontainer/.mnt-node_modules/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/.devcontainer/.mnt-tmp/.gitkeep b/.devcontainer/.mnt-tmp/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index e4452346..c1a819ce 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,69 +1,13 @@
-FROM node:24-bookworm
+FROM node:24-trixie
-# Install basic development tools
-RUN apt update && apt install -y less man-db sudo python3 pipx
+RUN apt update && apt install -y sudo build-essential
-RUN apt install -y \
- xvfb \
- fonts-noto-color-emoji \
- fonts-unifont \
- libfontconfig1 \
- libfreetype6 \
- xfonts-scalable \
- fonts-liberation \
- fonts-ipafont-gothic \
- fonts-wqy-zenhei \
- fonts-tlwg-loma-otf \
- fonts-freefont-ttf \
- libasound2 \
- libatk-bridge2.0-0 \
- libatk1.0-0 \
- libatspi2.0-0 \
- libcairo2 \
- libcups2 \
- libdbus-1-3 \
- libdrm2 \
- libgbm1 \
- libglib2.0-0 \
- libnspr4 \
- libnss3 \
- libpango-1.0-0 \
- libx11-6 \
- libxcb1 \
- libxcomposite1 \
- libxdamage1 \
- libxext6 \
- libxfixes3 \
- libxkbcommon0 \
- libxrandr2 \
- libxcursor1 \
- libgtk-3-0
-
-
-# Ensure default `node` user has access to `sudo`
ARG USERNAME=node
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
-RUN mkdir -p /workspaces/atomic-crm/node_modules && chown -R node:node /workspaces/atomic-crm
-
USER node
-RUN pipx install graphifyy
-
-RUN mkdir -p /home/node/.cache/ms-playwright
-
-
-RUN echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/node/.bashrc
RUN echo 'alias g="git"' >> /home/node/.bash_aliases
-WORKDIR /tmp
-
-RUN curl -fsSL https://claude.ai/install.sh -o claude-install.sh && \
- chmod +x claude-install.sh && \
- ./claude-install.sh && \
- rm claude-install.sh
-
-WORKDIR /workspaces/atomic-crm
-
ENV DEVCONTAINER=true
diff --git a/.devcontainer/claude-code/README.md b/.devcontainer/claude-code/README.md
new file mode 100644
index 00000000..637999ee
--- /dev/null
+++ b/.devcontainer/claude-code/README.md
@@ -0,0 +1 @@
+# Claude Code
diff --git a/.devcontainer/claude-code/devcontainer-feature.json b/.devcontainer/claude-code/devcontainer-feature.json
new file mode 100644
index 00000000..bfe2bf69
--- /dev/null
+++ b/.devcontainer/claude-code/devcontainer-feature.json
@@ -0,0 +1,22 @@
+{
+ "id": "claude-code",
+ "version": "1.0.0",
+ "name": "Claude Code",
+ "mounts": [
+ {
+ "type": "bind",
+ "source": "${localEnv:HOME}/.claude.json",
+ "target": "/home/node/.claude.json"
+ },
+ {
+ "type": "bind",
+ "source": "${localEnv:HOME}/.claude",
+ "target": "/home/node/.claude"
+ }
+ ],
+ "customizations": {
+ "vscode": {
+ "extensions": ["Anthropic.claude-code"]
+ }
+ }
+}
diff --git a/.devcontainer/claude-code/install.sh b/.devcontainer/claude-code/install.sh
new file mode 100755
index 00000000..4ca54cab
--- /dev/null
+++ b/.devcontainer/claude-code/install.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+set -e
+
+su - "$_CONTAINER_USER" <<'EOL'
+cd /tmp
+curl -fsSL https://claude.ai/install.sh -o claude-install.sh
+chmod +x claude-install.sh
+./claude-install.sh
+rm -f claude-install.sh
+echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/node/.bashrc
+EOL
diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json
index 219acb6b..26c6657b 100644
--- a/.devcontainer/devcontainer-lock.json
+++ b/.devcontainer/devcontainer-lock.json
@@ -1,3 +1,9 @@
{
- "features": {}
+ "features": {
+ "ghcr.io/postfinance/devcontainer-features/playwright-deps:1": {
+ "version": "1.0.0",
+ "resolved": "ghcr.io/postfinance/devcontainer-features/playwright-deps@sha256:1fbd235678d55637ddfb93c800249e48ae72af36cb382297ff3a22bab8945acb",
+ "integrity": "sha256:1fbd235678d55637ddfb93c800249e48ae72af36cb382297ff3a22bab8945acb"
+ }
+ }
}
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 2831b63d..064217fa 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -5,39 +5,25 @@
"dockerfile": "Dockerfile"
},
"workspaceFolder": "/workspaces/atomic-crm",
- "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/atomic-crm,type=bind,consistency=cached",
+ "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached",
"remoteUser": "node",
- "postCreateCommand": "make install-playwright-browsers",
- "mounts": [
- {
- "type": "bind",
- "source": "${localEnv:HOME}/.claude.json",
- "target": "/home/node/.claude.json"
- },
- {
- "type": "bind",
- "source": "${localEnv:HOME}/.claude",
- "target": "/home/node/.claude"
- },
- {
- "type": "bind",
- "source": "${localWorkspaceFolder}/.devcontainer/.mnt-ms-playwright-cache",
- "target": "/home/node/.cache/ms-playwright"
- },
- {
- "type": "bind",
- "source": "${localWorkspaceFolder}/.devcontainer/.mnt-tmp",
- "target": "/tmp"
+ "features": {
+ "./claude-code": {},
+ "./npm": {
+ "workspaceFolder": "${containerWorkspaceFolder}"
},
- {
- "type": "bind",
- "source": "${localWorkspaceFolder}/.devcontainer/.mnt-node_modules",
- "target": "/workspaces/atomic-crm/node_modules"
- }
- ],
+ "./playwright": {}
+ },
"customizations": {
"vscode": {
- "extensions": ["Anthropic.claude-code"]
+ "extensions": []
+ }
+ },
+ "mounts": [
+ {
+ "type": "volume",
+ "source": "${devcontainerId}-tmp",
+ "target": "/tmp"
}
- }
+ ]
}
diff --git a/.devcontainer/npm/README.md b/.devcontainer/npm/README.md
new file mode 100644
index 00000000..9f224329
--- /dev/null
+++ b/.devcontainer/npm/README.md
@@ -0,0 +1 @@
+# PNPM integration
diff --git a/.devcontainer/npm/devcontainer-feature.json b/.devcontainer/npm/devcontainer-feature.json
new file mode 100644
index 00000000..0d73c3b6
--- /dev/null
+++ b/.devcontainer/npm/devcontainer-feature.json
@@ -0,0 +1,20 @@
+{
+ "id": "npm",
+ "version": "1.0.0",
+ "name": "NPM",
+ "options": {
+ "workspaceFolder": {
+ "type": "string",
+ "default": "",
+ "description": "Absolute path to the workspace folder inside the container. Used to pre-create and own the node_modules volume mount point."
+ }
+ },
+ "postCreateCommand": "npm install",
+ "mounts": [
+ {
+ "type": "volume",
+ "source": "${devcontainerId}-node-modules",
+ "target": "${containerWorkspaceFolder}/node_modules"
+ }
+ ]
+}
diff --git a/.devcontainer/npm/install.sh b/.devcontainer/npm/install.sh
new file mode 100755
index 00000000..453e6428
--- /dev/null
+++ b/.devcontainer/npm/install.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+set -e
+
+WORKSPACE_FOLDER="${WORKSPACEFOLDER:-}"
+
+if [ -z "$WORKSPACE_FOLDER" ]; then
+ echo "The 'workspaceFolder' option is not set. Please set it to the workspace folder path inside the container."
+ exit 1
+fi
+
+NODE_MODULES_PATH="${WORKSPACE_FOLDER}/node_modules"
+
+mkdir -p "$NODE_MODULES_PATH" && chown -R $_CONTAINER_USER:$_CONTAINER_USER "$NODE_MODULES_PATH"
diff --git a/.devcontainer/playwright/README.md b/.devcontainer/playwright/README.md
new file mode 100644
index 00000000..0b962946
--- /dev/null
+++ b/.devcontainer/playwright/README.md
@@ -0,0 +1,22 @@
+# Playwright integration
+
+Installs Playwright system dependencies (via the `playwright-deps` feature) and
+persists downloaded browsers in a named volume across container rebuilds.
+
+## Cache folder
+
+The browser cache lives at `PLAYWRIGHT_BROWSERS_PATH` (default
+`/mount/.ms-playwright`). This single env var is the source of truth: the
+volume mount target (`${containerEnv:PLAYWRIGHT_BROWSERS_PATH}`) and the
+`install.sh` setup both read it.
+
+The dev container features spec does not allow a feature `option` to drive
+`containerEnv`/`mounts`, so to change the folder, override the env var in your
+`devcontainer.json` — the volume mount follows automatically:
+
+```jsonc
+{
+ "features": { "./playwright": {} },
+ "containerEnv": { "PLAYWRIGHT_BROWSERS_PATH": "/custom/path" }
+}
+```
diff --git a/.devcontainer/playwright/devcontainer-feature.json b/.devcontainer/playwright/devcontainer-feature.json
new file mode 100644
index 00000000..5f3ac9da
--- /dev/null
+++ b/.devcontainer/playwright/devcontainer-feature.json
@@ -0,0 +1,23 @@
+{
+ "id": "playwright",
+ "version": "1.0.0",
+ "name": "Playwright",
+ "postCreateCommand": "npx playwright install",
+ "containerEnv": {
+ "PLAYWRIGHT_BROWSERS_PATH": "/mount/.ms-playwright"
+ },
+ "dependsOn": {
+ "ghcr.io/postfinance/devcontainer-features/playwright-deps:1": {
+ "installChromiumDeps": true,
+ "installFirefoxDeps": true,
+ "installWebkitDeps": true
+ }
+ },
+ "mounts": [
+ {
+ "type": "volume",
+ "source": "${devcontainerId}-playwright",
+ "target": "/mount/.ms-playwright"
+ }
+ ]
+}
diff --git a/.devcontainer/playwright/install.sh b/.devcontainer/playwright/install.sh
new file mode 100755
index 00000000..add10d90
--- /dev/null
+++ b/.devcontainer/playwright/install.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+if [ -z "$PLAYWRIGHT_BROWSERS_PATH" ]; then
+ echo "PLAYWRIGHT_BROWSERS_PATH environment variable is not set. Please set it to the desired Playwright folder path."
+ exit 1
+fi
+
+mkdir -p "$PLAYWRIGHT_BROWSERS_PATH" && chown -R $_CONTAINER_USER:$_CONTAINER_USER "$PLAYWRIGHT_BROWSERS_PATH"
diff --git a/.gitignore b/.gitignore
index 7400ef77..8df74f62 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,5 @@ node_modules/
/playwright/.cache/
/playwright/.auth/
-.devcontainer/.mnt-*/*
-!.devcontainer/.mnt-*/.gitkeep
*.lock
+
\ No newline at end of file