Spaces:
Sleeping
Sleeping
File size: 756 Bytes
b52d67a 1e5f303 b52d67a a099c6f b52d67a a099c6f b52d67a 1e5f303 b52d67a a099c6f b52d67a a099c6f b52d67a 1e5f303 b52d67a 1e5f303 b52d67a 1e5f303 b52d67a 1e5f303 a099c6f |
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 |
# 1. Base image
FROM python:3.9-slim
# 2. Prevent __pycache__, buffer logs
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 3. Define where uploads go
ENV UPLOAD_DIR=/mnt/data
# 4. Set working dir
WORKDIR /app
# 5. System deps (only if you need to compile wheels)
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& rm -rf /var/lib/apt/lists/*
# 6. Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 7. Copy app code
COPY . .
# 8. Pre-create writable dirs
RUN mkdir -p "${UPLOAD_DIR}/uploads" static/images \
&& chmod -R 777 "${UPLOAD_DIR}/uploads" static/images
# 9. Expose & run
EXPOSE 7860
CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "app:app"]
|