Severian's picture
Update Dockerfile
5704284 verified
# Use Python 3.10 as base image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies for Pillow and other packages
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all application files
COPY server.py .
COPY index.html .
COPY ghost_engine.py .
COPY ghost_engine_configs.py .
COPY batch_process_images.py .
COPY batch_armor_images.py .
COPY armor.py .
COPY gp-logo.png .
# Copy assets folder
COPY assets/ ./assets/
# Copy Ghostprint module if it exists
COPY Ghostprint/ ./Ghostprint/
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Set environment variable for Flask
ENV FLASK_APP=server.py
ENV PYTHONUNBUFFERED=1
# Run the Flask server on 0.0.0.0:7860 using Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "4", "--timeout", "10000", "server:app"]