Skip to content

Commit cf755a4

Browse files
author
ide-coder
committed
fix: install uv via pre-built image for coder user accessibility
Use COPY from ghcr.io/astral-sh/uv:latest instead of install.sh which installs to /root/.local/bin inaccessible to non-root coder user.
1 parent bfd16c4 commit cf755a4

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

Dockerfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ RUN conda install -y python=3.13 \
7373
&& ln -sf /opt/conda/bin/pip /usr/bin/pip3 \
7474
&& ln -sf /opt/conda/bin/pip /usr/bin/pip
7575

76-
# Install uv
77-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
78-
ENV PATH=/root/.local/bin:/home/coder/.local/bin:$PATH
76+
# Install uv (official recommended way: copy from pre-built image)
77+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
7978

8079
# Layer 5: Node.js (latest LTS) with China mirror
8180
ENV NODE_VERSION=22
@@ -144,10 +143,20 @@ RUN /home/coder/.rbenv/plugins/ruby-build/install.sh \
144143
RUN echo "---\n:sources:\n - https://gems.ruby-china.com/" > /home/coder/.gemrc
145144

146145
# Layer 8: Directory structure and config files
146+
# Create directories for external mounting support
147147
RUN mkdir -p /home/coder/project \
148148
&& mkdir -p /home/coder/.local/share/code-server \
149-
&& mkdir -p /home/coder/.m2 \
150-
&& mkdir -p /home/coder/.config/pip
149+
&& mkdir -p /home/coder/.local/share/pnpm \
150+
&& mkdir -p /home/coder/.m2/repository \
151+
&& mkdir -p /home/coder/.config/pip \
152+
&& mkdir -p /home/coder/.npm \
153+
&& mkdir -p /home/coder/.cache/uv \
154+
&& mkdir -p /home/coder/.cache/pip \
155+
&& mkdir -p /home/coder/go
156+
157+
# Declare volumes for external mounting (optional, users can override with -v)
158+
# These can be mounted to persist data across container restarts
159+
VOLUME ["/home/coder/project"]
151160

152161
# Maven settings.xml with Aliyun mirror
153162
RUN echo '<?xml version="1.0" encoding="UTF-8"?>\n\

0 commit comments

Comments
 (0)