Spaces:
Sleeping
Sleeping
File size: 960 Bytes
2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 2c3baf8 e5815d0 | 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 41 42 43 44 | FROM python:3.10-slim
# Install system dependencies including nginx
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
curl \
nginx \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV HOME=/app
WORKDIR $HOME
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt gunicorn
# Copy entire project
COPY . .
# Setup nginx with your updated config for HF
COPY nginx/local.conf /etc/nginx/conf.d/default.conf
# Collect static files
RUN python manage.py collectstatic --noinput
# Create startup script
RUN echo '#!/bin/bash\n\
set -e\n\
echo "Starting Nginx..."\n\
nginx\n\
echo "Starting Gunicorn..."\n\
gunicorn core.wsgi:application --bind 0.0.0.0:8000\n\
' > /app/start.sh && chmod +x /app/start.sh
# Expose Hugging Face port
EXPOSE 7860
# Start both services
CMD ["/app/start.sh"] |