Spaces:
Sleeping
Sleeping
| FROM node:18-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci | |
| COPY frontend/ ./ | |
| ENV VITE_API_BASE_URL=/api | |
| RUN npm run build | |
| FROM python:3.10-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 libglib2.0-0 nginx \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /code | |
| COPY backend/requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| COPY backend/ /code/backend/ | |
| COPY --from=frontend-build /app/frontend/dist /code/frontend/dist | |
| RUN echo 'server { \ | |
| listen 7860; \ | |
| location /api/ { proxy_pass http://127.0.0.1:8000/; } \ | |
| location / { root /code/frontend/dist; try_files $uri $uri/ /index.html; } \ | |
| }' > /etc/nginx/sites-enabled/default | |
| RUN echo '#!/bin/bash\n\ | |
| nginx & \n\ | |
| cd /code/backend && uvicorn api:app --host 127.0.0.1 --port 8000\n\ | |
| ' > /code/start.sh && chmod +x /code/start.sh | |
| EXPOSE 7860 | |
| CMD ["/code/start.sh"] |