WebPass / Dockerfile
ag235772's picture
Fixed SQLite race condition with single gunicorn worker and forced db init
1b08971
raw
history blame contribute delete
631 Bytes
# Use lightweight Python 3.12 image
FROM python:3.12-slim
WORKDIR /app
# Install Nmap just so the Python library imports don't crash the server
RUN apt-get update && apt-get install -y nmap && rm -rf /var/lib/apt/lists/*
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all your code
COPY . .
# Hugging Face exposes port 7860
EXPOSE 7860
# --- THE FIX: 1 Worker, 8 Threads ---
# This stops race conditions where multiple workers try to create the SQLite DB at the same time
CMD ["gunicorn", "--workers", "1", "--threads", "8", "-b", "0.0.0.0:7860", "wsgi:app"]