File size: 619 Bytes
bc41a36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
## Dockerfile
FROM python:3.12-slim

WORKDIR /app

# Install Python dependencies + Gunicorn
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
    && pip install --no-cache-dir gunicorn

# Copy your application code
COPY . .

# (Optional) create a logs folder if you ever write files there
RUN mkdir -p /tmp/logs

# Spaces injects PORT (usually 7860); default to 7860 here
ARG PORT=7860
ENV PORT=${PORT}

# Tell Docker which port will be used
EXPOSE ${PORT}

# Launch via Gunicorn, binding to 0.0.0.0:$PORT
CMD gunicorn app:app \
    --bind 0.0.0.0:$PORT \
    --workers 1 \
    --timeout 120