Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Install system dependencies and Node.js | |
| RUN apt-get update && apt-get install -y curl build-essential \ | |
| && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ | |
| && apt-get install -y nodejs && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy Python requirements and install | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy project | |
| COPY . . | |
| # Build frontend | |
| WORKDIR /app/frontend | |
| RUN npm install --no-audit --prefer-offline | |
| RUN npm run build | |
| # Copy built frontend to Django static directory | |
| RUN mkdir -p /app/staticfiles/frontend && cp -r dist/* /app/staticfiles/frontend/ 2>/dev/null || true | |
| # Collect static files for Django (Whitenoise) | |
| WORKDIR /app | |
| ENV PORT=7860 | |
| EXPOSE ${PORT} | |
| RUN python manage.py collectstatic --noinput || true | |
| CMD ["gunicorn", "backend.backend.wsgi:application", "--bind", "0.0.0.0:7860"] | |