Spaces:
Sleeping
Sleeping
Commit ·
6d44873
1
Parent(s): a00882d
update
Browse files- Dockerfile +12 -7
Dockerfile
CHANGED
|
@@ -12,18 +12,22 @@ ENV FLASK_APP=api_server.py
|
|
| 12 |
ENV FLASK_RUN_HOST=0.0.0.0
|
| 13 |
ENV FLASK_RUN_PORT=7860
|
| 14 |
|
| 15 |
-
# Install system dependencies for
|
| 16 |
RUN apt-get update && apt-get install -y \
|
| 17 |
wget \
|
| 18 |
gnupg \
|
|
|
|
| 19 |
unzip \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
&&
|
|
|
|
|
|
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
| 27 |
|
| 28 |
# Copy the requirements file and install Python dependencies
|
| 29 |
COPY requirements.txt .
|
|
@@ -32,8 +36,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 32 |
# Copy the rest of the application files
|
| 33 |
COPY . .
|
| 34 |
|
| 35 |
-
# Expose the port the app runs on
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
# Command to run the Flask application
|
| 39 |
-
|
|
|
|
|
|
| 12 |
ENV FLASK_RUN_HOST=0.0.0.0
|
| 13 |
ENV FLASK_RUN_PORT=7860
|
| 14 |
|
| 15 |
+
# Install system dependencies needed for apt-add-repository and Chrome
|
| 16 |
RUN apt-get update && apt-get install -y \
|
| 17 |
wget \
|
| 18 |
gnupg \
|
| 19 |
+
curl \
|
| 20 |
unzip \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
+
# --- START: CORRECTED CHROME INSTALLATION ---
|
| 24 |
+
# This is the modern, secure way to add repository keys.
|
| 25 |
+
RUN curl -sS -o - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor | tee /etc/apt/keyrings/google-chrome.gpg >/dev/null \
|
| 26 |
+
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
| 27 |
+
&& apt-get update \
|
| 28 |
+
&& apt-get install -y google-chrome-stable \
|
| 29 |
&& rm -rf /var/lib/apt/lists/*
|
| 30 |
+
# --- END: CORRECTED CHROME INSTALLATION ---
|
| 31 |
|
| 32 |
# Copy the requirements file and install Python dependencies
|
| 33 |
COPY requirements.txt .
|
|
|
|
| 36 |
# Copy the rest of the application files
|
| 37 |
COPY . .
|
| 38 |
|
| 39 |
+
# Expose the port the app runs on (Hugging Face uses 7860 by default)
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
# Command to run the Flask application
|
| 43 |
+
# Use gunicorn for a more robust server in production if needed, but flask dev server is fine for spaces
|
| 44 |
+
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
|