Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a standard Python base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory inside the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Update package lists and install necessary dependencies for wkhtmltopdf
|
| 8 |
+
# These include fonts and rendering libraries
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
wget \
|
| 11 |
+
xfonts-75dpi \
|
| 12 |
+
xfonts-base \
|
| 13 |
+
libxrender1 \
|
| 14 |
+
&& apt-get clean \
|
| 15 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
+
|
| 17 |
+
# Download the specific version of wkhtmltopdf that is known to work
|
| 18 |
+
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb && \
|
| 19 |
+
# Install the package using dpkg
|
| 20 |
+
dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb && \
|
| 21 |
+
# Clean up the downloaded file
|
| 22 |
+
rm wkhtmltox_0.12.6-1.buster_amd64.deb
|
| 23 |
+
|
| 24 |
+
# Copy your application files into the container
|
| 25 |
+
COPY requirements.txt .
|
| 26 |
+
COPY app.py .
|
| 27 |
+
|
| 28 |
+
# Install the Python dependencies
|
| 29 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 30 |
+
|
| 31 |
+
# Expose the port that Flask will run on (matches app.py)
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
# The command to start your Flask application when the container launches
|
| 35 |
+
CMD ["python", "app.py"]
|