CNN / Dockerfile
sheethal0703's picture
Upload folder using huggingface_hub
e85e22c verified
raw
history blame contribute delete
860 Bytes
# Use Python 3.9 as base image
FROM python:3.9-slim
# Set working directory to /app
WORKDIR /app
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Create a non-root user and switch to it (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory (optional but good practice)
WORKDIR $HOME/app
# Copy the application code to the user's directory
COPY --chown=user . $HOME/app
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Command to run the application using gunicorn
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]