Skip to content

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

TypeScript

Improve devcontainer Dockerfile following best practices

toms74209200f91aed5440fa
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 04fffd16..29599d87 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -4,7 +4,8 @@ ARG TZ
ENV TZ="$TZ"
# Install basic development tools and iptables/ipset
-RUN apt update && apt install -y less \
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ less \
git \
procps \
sudo \
@@ -19,7 +20,8 @@ RUN apt update && apt install -y less \
iproute2 \
dnsutils \
aggregate \
- jq
+ jq \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
# Ensure default node user has access to /usr/local/share
RUN mkdir -p /usr/local/share/npm-global && \
@@ -42,10 +44,11 @@ RUN mkdir -p /workspace /home/node/.claude && \
WORKDIR /workspace
+ARG GIT_DELTA_VERSION=0.18.2
RUN ARCH=$(dpkg --print-architecture) && \
- wget "https://github.com/dandavison/delta/releases/download/0.18.2/git-delta_0.18.2_${ARCH}.deb" && \
- sudo dpkg -i "git-delta_0.18.2_${ARCH}.deb" && \
- rm "git-delta_0.18.2_${ARCH}.deb"
+ wget "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
+ sudo dpkg -i "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
+ rm "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb"
# Set up non-root user
USER node
@@ -58,7 +61,8 @@ ENV PATH=$PATH:/usr/local/share/npm-global/bin
ENV SHELL=/bin/zsh
# Default powerline10k theme
-RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \
+ARG ZSH_IN_DOCKER_VERSION=1.2.0
+RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
-p git \
-p fzf \
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index ca703862..b1ccf4b9 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -3,7 +3,9 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
- "TZ": "${localEnv:TZ:America/Los_Angeles}"
+ "TZ": "${localEnv:TZ:America/Los_Angeles}",
+ "GIT_DELTA_VERSION": "0.18.2",
+ "ZSH_IN_DOCKER_VERSION": "1.2.0"
}
},
"runArgs": [