File size: 1,724 Bytes
3ab509c
 
 
 
4fa97a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a48a425
 
 
4fa97a7
09b7376
a48a425
09b7376
3ab509c
09b7376
3ab509c
09b7376
 
a48a425
 
 
09b7376
 
75b2025
 
a48a425
09b7376
75b2025
 
 
09b7376
 
 
a48a425
 
 
 
4fa97a7
3ab509c
69c816c
 
75b2025
3ab509c
69c816c
75b2025
3ab509c
75b2025
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM python:3.13.5-slim

WORKDIR /app

# Install Node.js and system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    git \
    chromium \
    fonts-liberation \
    libasound2 \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libcups2 \
    libdbus-1-3 \
    libdrm2 \
    libgbm1 \
    libgtk-3-0 \
    libnspr4 \
    libnss3 \
    libxcomposite1 \
    libxdamage1 \
    libxfixes3 \
    libxkbcommon0 \
    libxrandr2 \
    xdg-utils \
    ca-certificates \
    fonts-freefont-ttf \
    && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

# Create necessary directories with proper permissions
RUN mkdir -p /tmp/.streamlit /app/.streamlit && \
    chmod -R 777 /tmp/.streamlit /app/.streamlit /tmp

# Copy package files
COPY requirements.txt ./
COPY package.json ./

# Install dependencies
RUN pip3 install -r requirements.txt
RUN npm install

# Copy Streamlit config
COPY .streamlit/ /app/.streamlit/

# Copy application files
COPY puppeteer_pdf.js ./
COPY api.py ./
COPY start.sh ./
COPY src/ ./src/

# Make start script executable
RUN chmod +x start.sh

# Set environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none
ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
ENV STREAMLIT_SERVER_ENABLE_CORS=false
ENV HOME=/tmp

# Expose port 7860 for Hugging Face (FastAPI)
# Port 8501 for Streamlit (internal)
EXPOSE 7860 8501

# Health check on FastAPI port
HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1

# Run startup script
CMD ["./start.sh"]