prx / Dockerfile
newservers's picture
Update Dockerfile
4eb9181 verified
Raw
History Blame Contribute Delete
661 Bytes
# Use official Python slim image for a leaner container
FROM python:3.10-slim
# Set environment variable for Hugging Face cache
ENV HF_HOME=/app/cache
# Set working directory
WORKDIR /app
# Copy the Flask app code
COPY app.py .
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install Python packages
RUN pip install --no-cache-dir \
flask \
transformers \
torch \
&& pip cache purge
# Create and set permissions for Hugging Face cache
RUN mkdir -p /app/cache && chmod -R 777 /app
# Expose port 5000 for Flask
EXPOSE 7860
# Run the Flask app
CMD ["python", "app.py"]