broadfield-dev commited on
Commit
7ee6d43
·
verified ·
1 Parent(s): 215cf9c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -9
Dockerfile CHANGED
@@ -4,13 +4,10 @@ FROM python:3.9-slim
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # --- THE CORRECT FIX ---
8
- # 1. The Debian 10 "Buster" repository is now on the archive server. We must point to the correct URL.
9
- # 2. We add "[trusted=yes]" because archived repositories may have expired GPG keys.
10
  RUN echo "deb [trusted=yes] http://archive.debian.org/debian buster main" > /etc/apt/sources.list.d/buster.list
11
 
12
- # Now, update the package lists. This will successfully find the old packages on the archive server.
13
- # Then, install all the necessary system libraries, which will now be found.
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
15
  wget \
16
  fontconfig \
@@ -23,7 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
23
  && apt-get clean \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
- # With all dependencies correctly installed, download and install the wkhtmltox package.
27
  RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb && \
28
  dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb && \
29
  rm wkhtmltox_0.12.6-1.buster_amd64.deb
@@ -32,11 +29,13 @@ RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkh
32
  COPY requirements.txt .
33
  COPY app.py .
34
 
35
- # Install the Python dependencies
36
  RUN pip install --no-cache-dir -r requirements.txt
37
 
38
  # Expose the port that Flask will run on
39
  EXPOSE 7860
40
 
41
- # The command to start your Flask application when the container launches
42
- CMD ["python", "app.py"]
 
 
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Add the archived Debian repository to find old libraries
 
 
8
  RUN echo "deb [trusted=yes] http://archive.debian.org/debian buster main" > /etc/apt/sources.list.d/buster.list
9
 
10
+ # Update package lists and install all system dependencies
 
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  wget \
13
  fontconfig \
 
20
  && apt-get clean \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Download and install the wkhtmltox package
24
  RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb && \
25
  dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb && \
26
  rm wkhtmltox_0.12.6-1.buster_amd64.deb
 
29
  COPY requirements.txt .
30
  COPY app.py .
31
 
32
+ # Install the Python dependencies (including gunicorn)
33
  RUN pip install --no-cache-dir -r requirements.txt
34
 
35
  # Expose the port that Flask will run on
36
  EXPOSE 7860
37
 
38
+ # --- THE CORRECTED FINAL LINE ---
39
+ # Use gunicorn to run the app. It's a production server that integrates properly with the platform.
40
+ # It looks for the 'app.py' file (module) and the 'app = Flask(...)' object (instance).
41
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]