File size: 836 Bytes
ddf44aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74f6581
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
FROM python:3.10

# Prevent Python from writing pyc files
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Create a non-root user (HF Spaces compatible)
RUN useradd -m -u 1000 backenduser
USER backenduser

# Set PATH
ENV PATH="/home/backenduser/.local/bin:$PATH"

# Set working directory
WORKDIR /app

# Copy requirements first (better caching)
COPY --chown=backenduser:backenduser requirements.txt /app/requirements.txt

# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy backend source code
COPY --chown=backenduser:backenduser . /app

# Create required runtime directories
RUN mkdir -p \
    resume \
    uploads \
    temp \
    logs

COPY --chown=user . /app
CMD ["gunicorn", "app:app", "--timeout", "180", "-w", "3", "--bind", "0.0.0.0:7860"]