File size: 770 Bytes
ea84df0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy requirements and install
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . /app/

# Hugging Face Spaces runs as user 1000 (non-root)
RUN chown -R 1000:1000 /app

# Expose the port Hugging Face Spaces expects
EXPOSE 7860

# Switch to the non-root user
USER 1000

# Run migrations and start Daphne ASGI server
CMD python manage.py migrate --noinput && daphne -b 0.0.0.0 -p 7860 flux_backend.asgi:application