File size: 1,115 Bytes
7c91070
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b8b0952
7c91070
b8b0952
 
7c91070
 
 
 
 
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
34
# Use a Python base image
FROM python:3.9

# Create a non-root user for security best practices
RUN useradd -m -u 1000 user
USER user

# Set environment variable for user's local bin path
ENV PATH="/home/user/.local/bin:$PATH"

# Set environment variables to prevent Python from buffering stdout/stderr
ENV PYTHONUNBUFFERED 1

# IMPORTANT FIX: Set Hugging Face cache directory to a writable location
ENV HF_HOME=/app/hf_cache

# Set the working directory inside the container
WORKDIR /app

# Copy requirements.txt and install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy the application file and other necessary files
COPY --chown=user ./app.py /app/app.py
# The cgpcorp_api_chat.py file is no longer needed as its logic is integrated into app.py
# Removed: COPY --chown=user ./cgpcorp_api_chat.py /app/cgpcorp_api_chat.py
COPY --chown=user ./README.md /app/README.md

# Command to run the application using uvicorn
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]