Skip to content

Commit 9fa8d41

Browse files
A lot of small improvements
1 parent e44f097 commit 9fa8d41

8 files changed

Lines changed: 95 additions & 57 deletions

File tree

.gitconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[init]
77
defaultBranch = main
88
[commit]
9-
gpgsign = true
9+
# Only set this to true if you have a GPG key configured and want to sign all your commits by default.
10+
gpgsign = false
1011
[push]
1112
autoSetupRemote = true
1213
[rerere]

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636
- name: Checkout
3737
uses: actions/checkout@v4
3838

39+
- name: Lint shell scripts
40+
run: |
41+
sudo apt-get update && sudo apt-get install -y shellcheck
42+
shellcheck devwork-versions .profile || true
43+
echo "Shell script linting completed"
44+
3945
- name: Set up QEMU
4046
uses: docker/setup-qemu-action@v3
4147

@@ -86,3 +92,19 @@ jobs:
8692
fi
8793
8894
docker run --rm --platform linux/amd64 $IMAGE_TAG devwork-versions
95+
96+
- name: Image size report
97+
run: |
98+
echo "### Image Size Report (Node ${{ matrix.node_version }})" >> $GITHUB_STEP_SUMMARY
99+
echo '```' >> $GITHUB_STEP_SUMMARY
100+
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" | grep "${{ matrix.node_version }}-node" || true
101+
echo '```' >> $GITHUB_STEP_SUMMARY
102+
103+
if [ "${{ github.event_name }}" = "pull_request" ]; then
104+
IMAGE_TAG="${{ env.IMAGE_NAME }}:${{ matrix.node_version }}-node"
105+
else
106+
IMAGE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.node_version }}-node"
107+
fi
108+
109+
SIZE=$(docker images --format "{{.Size}}" "$IMAGE_TAG" | head -1)
110+
echo "Image size: $SIZE"

.zshrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ~/.zshrc - Zsh-specific configuration
22

33
# History configuration
4-
export HISTFILE="~/shell-history/.zsh_history"
4+
export HISTFILE="$HOME/shell-history/.zsh_history"
55
export HISTSIZE=10000
66
export SAVEHIST=10000
77
export ZSH="$HOME/.oh-my-zsh"

Dockerfile

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,20 @@ RUN apt-get update && \
2929
jq \
3030
bat \
3131
eza \
32+
&& apt-get autoremove -y \
3233
&& apt-get clean \
33-
&& rm -rf /var/lib/apt/lists/*
34+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3435

3536
# Generate locale
3637
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
3738
locale-gen
3839
ENV LANG=en_US.UTF-8
3940
ENV LC_ALL=en_US.UTF-8
4041

41-
# Setup sudo for node user
42-
RUN echo "node ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/node && \
42+
# Setup sudo for node user (limited to package management only)
43+
RUN echo "node ALL=(root) NOPASSWD: /usr/bin/apt-get, /usr/bin/apt, /usr/bin/dpkg" > /etc/sudoers.d/node && \
4344
chmod 0440 /etc/sudoers.d/node
4445

45-
# Setup NPM global directory with proper permissions
46-
RUN umask 0002 && \
47-
groupadd -r npm && \
48-
usermod -a -G npm node && \
49-
mkdir -p /usr/local/share/npm-global && \
50-
chown :npm /usr/local/share/npm-global && \
51-
chmod g+s /usr/local/share/npm-global && \
52-
npm config set prefix /usr/local/share/npm-global
53-
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
54-
ENV PATH=/usr/local/share/npm-global/bin:$PATH
55-
5646
# Copy Git defaults to system-level config
5747
COPY .gitconfig /etc/gitconfig
5848

@@ -62,7 +52,6 @@ RUN chmod +x /usr/local/bin/devwork-versions
6252

6353
# Enable pnpm (latest - projects specify version via packageManager field)
6454
ENV PNPM_HOME="/pnpm"
65-
ENV PATH="$PNPM_HOME:$PATH"
6655
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
6756
RUN corepack enable && \
6857
corepack prepare pnpm@latest --activate
@@ -71,11 +60,13 @@ RUN corepack enable && \
7160
USER node
7261
WORKDIR /home/node
7362

74-
# Add user bin directories to PATH
75-
ENV PATH="/home/node/.cargo/bin:/home/node/.claude/bin:$PATH"
63+
# Setup all PATH directories and NPM config in one place
64+
ENV NPM_CONFIG_PREFIX="$HOME/.npm-global"
65+
ENV PATH="$HOME/.cargo/bin:$HOME/.claude/bin:$HOME/.npm-global/bin:$PNPM_HOME:$PATH"
7666

7767
# Configure NPM global for node user
78-
RUN npm config set prefix /usr/local/share/npm-global
68+
RUN npm config set prefix "$HOME/.npm-global" && \
69+
mkdir -p "$HOME/.npm-global"
7970

8071
# Install uv/uvx (Python package runner for AI tools)
8172
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
@@ -87,31 +78,36 @@ RUN curl -fsSL https://claude.ai/install.sh | bash
8778
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
8879

8980
# Install Oh My Zsh custom plugins
90-
RUN git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
91-
git clone --depth=1 https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting && \
92-
git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete && \
93-
git clone --depth=1 https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autoupdate
81+
ENV ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
82+
RUN git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM}/plugins/zsh-autosuggestions && \
83+
git clone --depth=1 https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM}/plugins/fast-syntax-highlighting && \
84+
git clone --depth=1 https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM}/plugins/zsh-autocomplete && \
85+
git clone --depth=1 https://github.com/TamCore/autoupdate-oh-my-zsh-plugins.git ${ZSH_CUSTOM}/plugins/autoupdate
9486

9587
# Copy shell configurations
96-
COPY --chown=node:node .profile /home/node/.profile
97-
COPY --chown=node:node .zshrc /home/node/.zshrc
88+
COPY --chown=node:node .profile $HOME/.profile
89+
COPY --chown=node:node .zshrc $HOME/.zshrc
90+
91+
# Copy Starship configuration
92+
RUN mkdir -p $HOME/.config
93+
COPY --chown=node:node starship.toml $HOME/.config/starship.toml
9894

9995
# Append .profile loading to .bashrc (don't overwrite existing)
100-
RUN echo "" >> ~/.bashrc && \
101-
echo "# Load shared profile" >> ~/.bashrc && \
102-
echo "if [ -f ~/.profile ]; then" >> ~/.bashrc && \
103-
echo " . ~/.profile" >> ~/.bashrc && \
104-
echo "fi" >> ~/.bashrc
96+
RUN echo "" >> $HOME/.bashrc && \
97+
echo "# Load shared profile" >> $HOME/.bashrc && \
98+
echo "if [ -f ~/.profile ]; then" >> $HOME/.bashrc && \
99+
echo " . ~/.profile" >> $HOME/.bashrc && \
100+
echo "fi" >> $HOME/.bashrc
105101

106102
# Git safe directory for mounted volumes
107-
RUN git config --global --add safe.directory '*'
103+
RUN git config --global --add safe.directory /workspace
108104

109105
# Create necessary directories with proper ownership
110-
RUN mkdir -p ~/shell-history \
111-
~/.local/share/zsh \
112-
~/.local/state/zsh-autocomplete/log \
113-
~/.local/share/pnpm/store \
114-
&& chown -R node:node ~/.local
106+
RUN mkdir -p $HOME/shell-history \
107+
$HOME/.local/share/zsh \
108+
$HOME/.local/state/zsh-autocomplete/log \
109+
$HOME/.local/share/pnpm/store \
110+
&& chown -R node:node $HOME/.local
115111

116112
# Set working directory
117113
WORKDIR /workspace

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A production-ready Node.js development container image with zsh, Oh My Zsh, Star
66

77
### Base Environment
88

9-
- Node.js (Debian Bookworm Slim base)
9+
- Node.js (Debian Trixie Slim base)
1010
- pnpm package manager (latest via Corepack)
1111
- GitHub CLI
1212
- Python 3, make, g++, build-essential
@@ -47,7 +47,7 @@ See `example.devcontainer.json` for a full configuration example including:
4747

4848
```json
4949
{
50-
"image": "ghcr.io/arthurfiorette/devwork:24-node",
50+
"image": "ghcr.io/arthurfiorette/devwork:lts-node",
5151
"customizations": {
5252
"vscode": {
5353
"settings": {
@@ -63,7 +63,7 @@ See `example.devcontainer.json` for a full configuration example including:
6363
```yaml
6464
services:
6565
devcontainer:
66-
image: ghcr.io/arthurfiorette/devwork:24-node
66+
image: ghcr.io/arthurfiorette/devwork:lts-node
6767
volumes:
6868
- .:/workspace
6969
command: sleep infinity
@@ -72,22 +72,22 @@ services:
7272
### Direct Docker Run
7373
7474
```bash
75-
docker run -it --rm ghcr.io/arthurfiorette/devwork:24-node zsh
75+
docker run -it --rm ghcr.io/arthurfiorette/devwork:lts-node zsh
7676
```
7777

7878
## Available Tags
7979

8080
The image is published with tags for different Node.js versions:
8181

82+
- `lts-node` - Node.js LTS version
83+
- `lts-node-abc1234` - Node.js LTS at specific commit
84+
8285
- `24-node` - Node.js 24.x (recommended)
8386
- `24-node-abc1234` - Node.js 24.x at specific commit
8487
- `22-node` - Node.js 22.x
8588
- `22-node-abc1234` - Node.js 22.x at specific commit
8689

87-
- `lts-node` - Node.js LTS version
88-
- `lts-node-abc1234` - Node.js LTS at specific commit
89-
90-
Use version tags (e.g., `24-node`) for the latest build, or commit-specific tags (e.g., `24-node-abc1234`) to pin to a specific version. Images are rebuilt weekly with security updates.
90+
Use version tags (e.g., `lts-node`) for the latest build, or commit-specific tags (e.g., `lts-node-abc1234`) to pin to a specific version. Images are rebuilt weekly with security updates.
9191

9292
## Features
9393

devwork-versions

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,29 @@
22
# devwork-versions - Display versions of all installed development tools
33
# Can be used as healthcheck or verification script
44

5-
set -e
5+
# Helper function to safely get version or return NOT FOUND
6+
get_version() {
7+
tool_name="$1"
8+
version_cmd="$2"
69

7-
echo "bat: $(bat --version 2>&1 | head -1 | awk '{print $2}')"
8-
echo "Claude: $(claude --version 2>&1 | head -1 || echo 'not found')"
9-
echo "eza: $(eza --version 2>&1 | head -1 | awk '{print $2}')"
10-
echo "jq: $(jq --version 2>&1 | head -1 | sed 's/jq-//')"
11-
echo "Node.js: $(node --version)"
12-
echo "pnpm: $(pnpm --version 2>&1 | head -1)"
13-
echo "ripgrep: $(rg --version 2>&1 | head -1 | awk '{print $2}')"
14-
echo "Starship: $(starship --version 2>&1 | head -1 | awk '{print $2}')"
15-
echo "uvx: $(uvx --version 2>&1 | head -1)"
16-
echo "zsh: $(zsh --version 2>&1 | head -1 | awk '{print $2}')"
10+
if command -v "$(echo "$version_cmd" | awk '{print $1}')" >/dev/null 2>&1; then
11+
version=$(eval "$version_cmd" 2>&1 | head -1 || echo "ERROR")
12+
else
13+
version="NOT FOUND"
14+
fi
15+
16+
printf "%-12s %s\n" "$tool_name:" "$version"
17+
}
18+
19+
# Display versions
20+
get_version "bat" "bat --version | awk '{print \$2}'"
21+
get_version "Claude" "claude --version"
22+
get_version "eza" "eza --version | awk '{print \$2}'"
23+
get_version "jq" "jq --version | sed 's/jq-//'"
24+
get_version "Node.js" "node --version"
25+
get_version "npm" "npm --version"
26+
get_version "pnpm" "pnpm --version"
27+
get_version "ripgrep" "rg --version | awk '{print \$2}'"
28+
get_version "Starship" "starship --version | awk '{print \$2}'"
29+
get_version "uvx" "uvx --version"
30+
get_version "zsh" "zsh --version | awk '{print \$2}'"

example.devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
33
"name": "Node.js Project",
4-
"image": "ghcr.io/arthurfiorette/devwork:24-node",
4+
"image": "ghcr.io/arthurfiorette/devwork:lts-node",
55
"workspaceFolder": "/workspace",
66
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
77

starship.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Starship configuration for devwork containers
2+
# Minimal config - only disable Docker to avoid clutter
3+
4+
[docker_context]
5+
disabled = true

0 commit comments

Comments
 (0)