sarveshpatel commited on
Commit
5b1a5a3
·
verified ·
1 Parent(s): b6145fb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -12,10 +12,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
12
  # Install the Codex CLI globally.
13
  RUN npm install -g @openai/codex && codex --version
14
 
15
- # HF Spaces run as uid 1000. Create that user.
16
- RUN useradd -m -u 1000 user
17
- ENV HOME=/home/user \
18
- PATH=/home/user/.local/bin:$PATH \
19
  # Point Codex at the persistent bucket so auth.json + sessions survive restarts.
20
  CODEX_HOME=/data/.codex \
21
  # Defaults (override via Space variables/secrets).
@@ -24,17 +24,17 @@ ENV HOME=/home/user \
24
 
25
  WORKDIR /app
26
 
27
- # Python deps (installed for the non-root user).
28
- COPY --chown=user requirements.txt /app/requirements.txt
29
  RUN pip3 install --no-cache-dir --break-system-packages -r /app/requirements.txt
30
 
31
- COPY --chown=user app.py /app/app.py
32
- COPY --chown=user codex_engine.py /app/codex_engine.py
33
- COPY --chown=user start.sh /app/start.sh
34
- COPY --chown=user AGENTS.global.md /app/AGENTS.global.md
35
  RUN chmod +x /app/start.sh
36
 
37
- USER user
38
  EXPOSE 7860
39
 
40
  ENTRYPOINT ["/usr/bin/tini", "--"]
 
12
  # Install the Codex CLI globally.
13
  RUN npm install -g @openai/codex && codex --version
14
 
15
+ # HF Spaces run as uid 1000. The node base image already ships a `node` user at
16
+ # uid 1000, so reuse it instead of creating a duplicate.
17
+ ENV HOME=/home/node \
18
+ PATH=/home/node/.local/bin:$PATH \
19
  # Point Codex at the persistent bucket so auth.json + sessions survive restarts.
20
  CODEX_HOME=/data/.codex \
21
  # Defaults (override via Space variables/secrets).
 
24
 
25
  WORKDIR /app
26
 
27
+ # Python deps (installed system-wide so the node user can run uvicorn).
28
+ COPY --chown=node requirements.txt /app/requirements.txt
29
  RUN pip3 install --no-cache-dir --break-system-packages -r /app/requirements.txt
30
 
31
+ COPY --chown=node app.py /app/app.py
32
+ COPY --chown=node codex_engine.py /app/codex_engine.py
33
+ COPY --chown=node start.sh /app/start.sh
34
+ COPY --chown=node AGENTS.global.md /app/AGENTS.global.md
35
  RUN chmod +x /app/start.sh
36
 
37
+ USER node
38
  EXPOSE 7860
39
 
40
  ENTRYPOINT ["/usr/bin/tini", "--"]