email-pii-classifier / Dockerfile
nitinprajwal's picture
Update Dockerfile
bfc8ca3 verified
raw
history blame contribute delete
753 Bytes
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy only the requirements file first to leverage Docker cache
COPY requirements.txt .
# Install dependencies
# The en_core_web_sm model is installed via requirements.txt as it's specified with a URL.
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
# This includes app.py, pii_masking.py, email_classifier.joblib, etc.
# Ensure .dockerignore is used to exclude unnecessary files.
COPY . .
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Run the FastAPI application with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]