From e080dd37facc5f9eed1898bd9a547c5b347a5491 Mon Sep 17 00:00:00 2001 From: Maaz Ghani Date: Tue, 4 Aug 2026 14:20:07 -0700 Subject: [PATCH] Improve devcontainer setup --- .devcontainer/Dockerfile | 25 +++++++++++++++++++++++++ .devcontainer/devcontainer.json | 22 +++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..5ac255d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +# syntax=docker/dockerfile:1 + +ARG NODE_VERSION=22 +ARG PNPM_VERSION=10.14.0 + +FROM mcr.microsoft.com/devcontainers/javascript-node:1-${NODE_VERSION}-bookworm + +ARG PNPM_VERSION + +ENV NEXT_TELEMETRY_DISABLED=1 \ + PNPM_HOME=/pnpm \ + PATH=/pnpm:${PATH} + +RUN install -d -o node -g node /pnpm \ + && npm install --global "pnpm@${PNPM_VERSION}" \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + git \ + openssh-client \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +USER node +WORKDIR /workspace/git-to.dev diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5ab570c..5b755ed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,32 @@ { "name": "git-to.dev", "build": { - "dockerfile": "../Dockerfile", - "context": "..", - "target": "development" + "dockerfile": "Dockerfile", + "context": ".", + "args": { + "NODE_VERSION": "22", + "PNPM_VERSION": "10.14.0" + } }, "workspaceFolder": "/workspace/${localWorkspaceFolderBasename}", "remoteUser": "node", - "forwardPorts": [3000], + "containerEnv": { + "NEXT_TELEMETRY_DISABLED": "1" + }, + "mounts": [ + "type=volume,source=git-to-dev-pnpm-store,target=/pnpm/store" + ], + "forwardPorts": [ + 3000 + ], "portsAttributes": { "3000": { "label": "Next.js development server", "onAutoForward": "notify" } }, - "postCreateCommand": "pnpm install --frozen-lockfile", + "postCreateCommand": "pnpm config set store-dir /pnpm/store && pnpm install --frozen-lockfile", + "postAttachCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", "customizations": { "vscode": { "extensions": [