File size: 1,403 Bytes
c061ce5
 
 
 
 
544035f
c061ce5
 
 
 
24a068d
544035f
c061ce5
 
 
 
 
 
 
 
 
24a068d
66122d4
 
db369bb
544035f
c061ce5
4d1cb0c
24a068d
 
c061ce5
 
 
 
 
4d1cb0c
c061ce5
 
 
 
 
 
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
# ==============================================================================
# DEPLOYMENT: Hugging Face Spaces (Docker)
# PROJECT: DEPRESSION-DETECTION-USING-TWEETS
# ==============================================================================

FROM python:3.9-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Force legacy setuptools behavior
ENV SETUPTOOLS_USE_DISTUTILS=stdlib

# Set work directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \

    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Fix for legacy builds: downgrade tools and disable build isolation
RUN pip install --upgrade "pip<23.1" "setuptools<58.0" "wheel<0.41.0"
RUN pip install "packaging<22.0" "cython<3.0"

# Install project dependencies
# Note: Path is relative to the repository root where Dockerfile resides
COPY source_code/requirements.txt ./
# --no-build-isolation is critical to allow our downgraded tools to handle legacy metadata
RUN pip install --no-cache-dir --no-build-isolation -r requirements.txt

# Download spaCy model required for the NLP pipeline
RUN python -m spacy download en_core_web_lg

# Copy project source code
COPY source_code/ ./

# Hugging Face Spaces requires port 7860
EXPOSE 7860

# Run the Flask application
CMD ["python", "app.py"]