File size: 1,142 Bytes
d437304
 
 
d469737
 
 
 
 
8324e06
 
d437304
bcfb2da
 
 
 
8324e06
d469737
bcfb2da
d437304
40e0008
 
 
 
 
d437304
8324e06
40e0008
 
d469737
8324e06
d437304
 
 
40e0008
d437304
 
 
 
 
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
38
39
# Dockerfile
FROM python:3.10-slim

# --- START CACHE BUSTER ---
# This command forces the build system to re-run the subsequent installation step.
RUN echo "Forcing a fresh install of unoconv dependencies."
# --- END CACHE BUSTER ---

# IMPORTANT: Install System Dependencies as the root user first.
# This step MUST come before switching to the 'user' account.
RUN apt-get update && \
    apt-get install -y \
        libreoffice \
        unoconv \
        python3-uno \
        locales \
        # Add a dummy package here, if necessary, to break cache again, e.g., 'ca-certificates'
        && \
    rm -rf /var/lib/apt/lists/*
    
# Set up a non-root user (Standard Hugging Face practice)
RUN useradd -m -u 1000 user
ENV HOME=/home/user
USER user

# Set working directory for the user
WORKDIR /home/user/app

# Install Python dependencies from requirements.txt (must only contain 'gradio')
COPY requirements.txt /home/user/app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code
COPY app.py /home/user/app/

# Set the entry point for Gradio
ENV GRADIO_SERVER_PORT 7860
EXPOSE 7860
CMD ["python3", "app.py"]