File size: 2,199 Bytes
f6a0599
c17df98
9961338
 
 
 
90f54af
f6a0599
 
 
 
 
90f54af
f6a0599
9961338
90f54af
 
 
 
 
58110a5
90f54af
f6a0599
90f54af
 
 
 
 
 
 
 
 
 
 
 
 
f6a0599
90f54af
f6a0599
 
90f54af
 
 
f6a0599
 
 
 
 
90f54af
f6a0599
 
9961338
 
 
f6a0599
 
9961338
 
 
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
# Use the official Python image as the base
FROM python:3.10

# Set working directory
WORKDIR /app

# Install system dependencies required for wkhtmltopdf
RUN apt-get update && apt-get install -y \
    libxrender1 \
    libfontconfig1 \
    libxext6 \
    xvfb \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Manually download and install wkhtmltopdf 0.12.6
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb \
    && dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb || apt-get update && apt-get install -f -y \
    && rm wkhtmltox_0.12.6-1.buster_amd64.deb \
    && rm -rf /var/lib/apt/lists/*

# Debug: Verify wkhtmltopdf and wkhtmltoimage installation
RUN wkhtmltopdf --version || { echo "wkhtmltopdf installation failed"; exit 1; }
RUN wkhtmltoimage --version || { echo "wkhtmltoimage installation failed"; exit 1; }

# Debug: List wkhtmltoimage binary locations
RUN echo "Checking for wkhtmltoimage in common locations:" \
    && ls -l /usr/local/bin/wkhtmltoimage 2>/dev/null || echo "/usr/local/bin/wkhtmltoimage not found" \
    && ls -l /usr/bin/wkhtmltoimage 2>/dev/null || echo "/usr/bin/wkhtmltoimage not found" \
    && ls -l /bin/wkhtmltoimage 2>/dev/null || echo "/bin/wkhtmltoimage not found" \
    && find / -name wkhtmltoimage 2>/dev/null || echo "wkhtmltoimage not found anywhere"

# Ensure wkhtmltoimage is in /usr/bin for consistency
RUN if [ -f /usr/local/bin/wkhtmltoimage ]; then \
        ln -sf /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage && \
        chmod +x /usr/bin/wkhtmltoimage; \
    else \
        echo "wkhtmltoimage not found in /usr/local/bin"; \
    fi

# Verify wkhtmltoimage in /usr/bin
RUN ls -l /usr/bin/wkhtmltoimage 2>/dev/null || echo "/usr/bin/wkhtmltoimage not created"

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

# Copy the application code
COPY schedule_generator.py .

# Expose the port Gradio will run on
EXPOSE 7860

# Set environment variables for Gradio
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT=7860

# Command to run the application
CMD ["python", "schedule_generator.py"]