File size: 1,298 Bytes
64fb021
 
 
 
 
 
 
 
 
 
 
6753f90
64fb021
 
6753f90
 
 
64fb021
 
36b0d31
64fb021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.11-slim

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

# Set the working directory in the container
WORKDIR /app

# Install system dependencies required for packages like psycopg2, pillow, and pycairo
# Install system dependencies required for building Python packages like pycairo
RUN apt-get update && apt-get install -y \
    build-essential \
    pkg-config \
    python3-dev \
    libcairo2-dev \
    libpq-dev \
    libpangocairo-1.0-0 \
    libgdk-pixbuf-2.0-0 \
    libffi-dev \
    shared-mime-info \
    && rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt /app/

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

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

# Create a non-privileged user to run the app (required by some hosting environments)
RUN useradd -m myuser
USER myuser

# Expose the port the app runs on (Hugging Face Spaces typically use 7860)
EXPOSE 7860

# Command to run the application using Gunicorn (included in your requirements)
# Note: Using 0.0.0.0 is essential for container accessibility
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "respirex_backend.wsgi:application"]