Baida commited on
Commit
d9a9e2a
·
verified ·
1 Parent(s): ee677bf

fix(docker): COPY backend/ not root — main.py at /home/user/app/main.py

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -3
Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM python:3.11-slim
3
  ENV PYTHONUNBUFFERED=1 \
4
  PYTHONDONTWRITEBYTECODE=1 \
5
  PORT=7860 \
6
- FRONTEND_DIST=/home/user/app/static \
7
  PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
8
 
9
  WORKDIR /app
@@ -15,7 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
15
  libxfixes3 libxrandr2 libgbm1 libasound2 \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
- COPY requirements.txt /app/requirements.txt
 
19
  RUN pip install --no-cache-dir -r /app/requirements.txt \
20
  && playwright install chromium \
21
  && chmod -R 755 /ms-playwright
@@ -32,7 +33,8 @@ USER user
32
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
33
 
34
  WORKDIR /home/user/app
35
- COPY --chown=user . /home/user/app/
 
36
 
37
  EXPOSE 7860
38
  CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1"]
 
3
  ENV PYTHONUNBUFFERED=1 \
4
  PYTHONDONTWRITEBYTECODE=1 \
5
  PORT=7860 \
6
+ PYTHONPATH=/home/user/app \
7
  PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
8
 
9
  WORKDIR /app
 
15
  libxfixes3 libxrandr2 libgbm1 libasound2 \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Space has backend/ subdir (full repo push) — copy from backend/
19
+ COPY backend/requirements.txt /app/requirements.txt
20
  RUN pip install --no-cache-dir -r /app/requirements.txt \
21
  && playwright install chromium \
22
  && chmod -R 755 /ms-playwright
 
33
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
34
 
35
  WORKDIR /home/user/app
36
+ # Copy only backend/ contents → main.py lands at /home/user/app/main.py
37
+ COPY --chown=user backend/ /home/user/app/
38
 
39
  EXPOSE 7860
40
  CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1"]