Draken1606 commited on
Commit
ce3ae8b
·
1 Parent(s): cd77570

Fix package structure in Docker: copy into undertrial_ai/ subdir for correct import

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -7
Dockerfile CHANGED
@@ -5,21 +5,27 @@ RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
- WORKDIR /app
 
 
9
 
10
  # Install server dependencies first (layer caching)
11
  COPY --chown=user server/requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- # Copy full package source
15
- COPY --chown=user . /app
16
 
17
- # Install the undertrial_ai package (regular install, not editable — works in Docker)
18
- RUN pip install --no-cache-dir --upgrade .
 
 
19
 
 
 
20
 
21
- # Episode data directory (falls back to built-in demo episodes if empty)
22
- ENV UNDERTRIAL_EPISODES_DIR=/app/data/episodes
23
 
24
  # HuggingFace Spaces requires port 7860
25
  EXPOSE 7860
 
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
+ # /workspace is the pip build root
9
+ # /workspace/undertrial_ai is the actual Python package
10
+ WORKDIR /workspace
11
 
12
  # Install server dependencies first (layer caching)
13
  COPY --chown=user server/requirements.txt requirements.txt
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
 
16
+ # Copy pyproject.toml to workspace root (pip needs it here)
17
+ COPY --chown=user pyproject.toml pyproject.toml
18
 
19
+ # Copy entire project into undertrial_ai/ subdirectory
20
+ # This creates: /workspace/undertrial_ai/__init__.py etc.
21
+ # which is the correct importable structure
22
+ COPY --chown=user . /workspace/undertrial_ai/
23
 
24
+ # pip install from /workspace — setuptools finds undertrial_ai/ package dir
25
+ RUN pip install --no-cache-dir --upgrade .
26
 
27
+ # Episode data directory (built-in demo episodes used as fallback)
28
+ ENV UNDERTRIAL_EPISODES_DIR=/workspace/undertrial_ai/data/episodes
29
 
30
  # HuggingFace Spaces requires port 7860
31
  EXPOSE 7860