Vscode / Dockerfile
Hemifield's picture
Update Dockerfile
ef7051c verified
Raw
History Blame Contribute Delete
1.66 kB
# syntax=docker/dockerfile:1
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8
# ---- System packages + Node.js 22 (required by the Claude Code / Codex CLIs) ----
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates gnupg git git-lfs build-essential \
python3 python3-pip sudo openssh-client unzip vim nano \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
# ---- code-server (VS Code in the browser) ----
RUN curl -fsSL https://code-server.dev/install.sh | sh
# ---- Claude Code + OpenAI Codex CLIs, installed globally into the image ----
RUN npm install -g @anthropic-ai/claude-code @openai/codex \
&& npm cache clean --force
# ---- HF Spaces containers run as UID 1000 ----
# Ubuntu 24.04 already ships a default "ubuntu" user at UID 1000, so remove
# whichever user currently holds that UID before creating ours.
RUN existing_uid_1000="$(getent passwd 1000 | cut -d: -f1)"; \
if [ -n "$existing_uid_1000" ]; then userdel -r "$existing_uid_1000" 2>/dev/null || true; fi \
&& useradd -m -u 1000 -s /bin/bash user \
&& echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user \
&& mkdir -p /data && chown user:user /data
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user
COPY --chown=user:user entrypoint.sh /home/user/entrypoint.sh
RUN chmod +x /home/user/entrypoint.sh
# HF Spaces expects the container to listen on this port (see README.md app_port)
EXPOSE 7860
ENTRYPOINT ["/home/user/entrypoint.sh"]