File size: 1,659 Bytes
373bb4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef7051c
 
 
 
 
373bb4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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"]