wolfofbackstreet's picture
Update Dockerfile
f3118ca verified
raw
history blame contribute delete
634 Bytes
# Use the official Python slim image for a smaller footprint
FROM python:3.11-slim
# Set working directory
WORKDIR /app
ARG API_TOKEN=$API_TOKEN
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the Flask app code
COPY . .
# Create a non-root user for security (Hugging Face requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
ENV API_TOKEN=$API_TOKEN
# Expose port 7860 (required by Hugging Face)
EXPOSE 7860
# Run the Flask app with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]