File size: 1,135 Bytes
f8f9c82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b344704
 
 
511ad2d
 
 
 
f8f9c82
868557a
f8f9c82
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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"]