Spaces:
Sleeping
Sleeping
File size: 930 Bytes
58c1398 | 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 | # Use the official Python 3.10 slim image
FROM python:3.10-slim
# Set proper timezone or environment parameters if needed
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PORT=7860
# Set the working directory directly to /app
WORKDIR /app
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the current directory contents into the container at /app
COPY . .
# Ensure the instance and uploads folder exist and have given permissions
RUN mkdir -p uploads instance \
&& chmod -R 777 uploads instance \
&& chmod -R 777 /app
# Expose the standard Hugging Face Spaces port
EXPOSE 7860
# Set the entrypoint to run the database setup and then launch gunicorn
CMD python -c "from server import app, db; app.app_context().push(); db.create_all()" && gunicorn --bind 0.0.0.0:$PORT --workers 2 --threads 4 --timeout 120 server:app
|