Unit4_scoring / Dockerfile
Jofthomas's picture
Jofthomas HF Staff
Update Dockerfile
b344704 verified
# Use an official Python runtime as a parent image
# Using a specific version like 3.10 or 3.11 is recommended over 'latest'
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies if needed (e.g., build tools) - add if required later
# RUN apt-get update && apt-get install -y --no-install-recommends some-package && rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt .
# Install Python dependencies
# --no-cache-dir reduces image size
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Explicitly create cache dir and set open permissions during build
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
# Set environment variables for Hugging Face cache directories
ENV HF_HOME=/app/.cache/huggingface
ENV HF_DATASETS_CACHE=/app/.cache/datasets
# Expose the port the app runs on
EXPOSE 7860
# Define the command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]