Spaces:
Sleeping
Sleeping
File size: 908 Bytes
7ba882a e0a3821 7ba882a 2fda754 7ba882a | 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 | 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"]
|