Spaces:
Sleeping
Sleeping
File size: 976 Bytes
b08d550 671fed1 b08d550 | 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 |
FROM node:20-alpine AS frontend-build
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
FROM python:3.11-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends git ffmpeg && \
rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Create data dir while still root, then chown it
RUN mkdir -p data && chown user:user data
COPY --chown=user requirements.txt .
USER user
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir -r requirements.txt
COPY --chown=user backend/ ./backend/
COPY --from=frontend-build --chown=user /app/frontend/dist ./frontend/dist/
EXPOSE 7860
WORKDIR $HOME/app/backend
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |