File size: 745 Bytes
03e4ce7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381f642
03e4ce7
381f642
 
7f5a3a7
 
381f642
7f5a3a7
381f642
7f5a3a7
 
381f642
03e4ce7
7f5a3a7
03e4ce7
 
 
 
 
 
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
35
36
37
FROM python:3.12-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app
COPY app.py .

# Create a non-root user with proper home directory
RUN useradd -m -u 1000 user
ENV HOME=/home/user
ENV HF_HOME=/home/user/.cache/huggingface
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860

# Create cache directories and set permissions
RUN mkdir -p /home/user/.cache/huggingface && \
    chown -R user:user /home/user && \
    chown -R user:user /app

USER user
WORKDIR /app

# Expose port
EXPOSE 7860

# Run the app
CMD ["python", "app.py"]