Skip to content

Commit 08eed8e

Browse files
committed
fix claude auto update
1 parent c8317f1 commit 08eed8e

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

Dockerfile

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ RUN apk add --no-cache \
1111
bash \
1212
&& rm -rf /var/cache/apk/*
1313

14-
# Install npm packages globally
15-
RUN npm install -g @anthropic-ai/claude-code@2.0.21 \
16-
&& npm cache clean --force
14+
# Create non-root user first
15+
RUN adduser -D -s /bin/bash devusr \
16+
&& addgroup devusr wheel \
17+
&& echo 'devusr ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
1718

18-
# Install uv Python package manager
19-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
20-
&& rm -rf /tmp/*
19+
# uv will be installed later as devusr
2120

2221
# Install Go - multi-platform support for amd64 and arm64
2322
ARG TARGETPLATFORM
@@ -31,29 +30,29 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
3130
&& rm "go1.24.7.linux-${GO_ARCH}.tar.gz" \
3231
&& ln -sf /usr/local/go/bin/go /usr/bin/go
3332

34-
# Install Rust - minimal profile to save space
33+
# Install Rust as devusr with minimal profile to save space
34+
USER devusr
3535
ENV RUSTUP_PROFILE=minimal
36+
ENV HOME=/home/devusr
3637
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal \
37-
&& chmod +x /root/.cargo/env
38-
39-
# Create non-root user
40-
RUN adduser -D -s /bin/bash devusr \
41-
&& addgroup devusr wheel \
42-
&& echo 'devusr ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
43-
44-
# Copy tool installations to user and set ownership
45-
RUN cp -r /root/.cargo /home/devusr/ \
46-
&& cp -r /root/.rustup /home/devusr/ \
47-
&& cp -r /root/.local /home/devusr/ \
48-
&& chown -R devusr:devusr /home/devusr/.cargo /home/devusr/.rustup /home/devusr/.local \
38+
&& chmod +x /home/devusr/.cargo/env \
4939
# Remove unnecessary Rust components to save space (~180M savings)
5040
&& rm -rf /home/devusr/.rustup/toolchains/stable-*/share/doc \
5141
&& rm -rf /home/devusr/.rustup/toolchains/stable-*/share/man \
5242
&& rm -rf /home/devusr/.rustup/toolchains/stable-*/lib/rustlib/*/bin \
5343
&& rm -f /home/devusr/.rustup/toolchains/stable-*/lib/rustlib/*/lib/libtest-*.rlib
5444

45+
# Install Claude Code and uv as devusr
46+
RUN npm config set prefix '~/.npm-global' \
47+
&& npm install -g @anthropic-ai/claude-code@2.0.21 \
48+
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
49+
&& rm -rf /tmp/*
50+
51+
# Switch back to root for remaining installations
52+
USER root
53+
5554
# Set PATH for all tools (using literal paths since HOME expands at runtime)
56-
ENV PATH="/home/devusr/.cargo/bin:/usr/local/go/bin:/home/devusr/.local/bin:$PATH"
55+
ENV PATH="/home/devusr/.cargo/bin:/usr/local/go/bin:/home/devusr/.local/bin:/home/devusr/.npm-global/bin:/usr/local/bin:$PATH"
5756

5857
# Set working directory
5958
WORKDIR /devbox

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The easiest way to use DevBox is with the provided launch script:
3434

3535
1. Build the Docker image:
3636
```bash
37-
docker build -t devbox:latest .
37+
docker build --no-cache -t devbox:latest .
3838
```
3939
2. Run the container:
4040
```bash

0 commit comments

Comments
 (0)