Spaces:
Sleeping
Sleeping
Kevin King
commited on
Commit
·
eccdfe0
1
Parent(s):
b63fd62
fix: consolidate system dependency installation and remove redundant command
Browse files- Dockerfile +7 -10
Dockerfile
CHANGED
|
@@ -2,28 +2,25 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
|
|
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
| 9 |
software-properties-common \
|
| 10 |
git \
|
|
|
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
# Force install the missing library required by OpenCV
|
| 15 |
-
RUN apt-get install -y libgl1-mesa-glx
|
| 16 |
-
# ============================================
|
| 17 |
-
|
| 18 |
-
# Copy and install Python requirements
|
| 19 |
COPY requirements.txt ./
|
| 20 |
COPY src/ ./src/
|
| 21 |
-
RUN pip3 install -r requirements.txt
|
| 22 |
|
| 23 |
-
# Expose the
|
| 24 |
EXPOSE 8501
|
| 25 |
|
| 26 |
-
# Healthcheck to
|
| 27 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 28 |
|
| 29 |
# Command to run the Streamlit application
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Combine all system dependency installations into a single RUN command
|
| 6 |
+
# This ensures apt-get update runs every time a new package is added.
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
build-essential \
|
| 9 |
curl \
|
| 10 |
software-properties-common \
|
| 11 |
git \
|
| 12 |
+
libgl1-mesa-glx \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
+
# Copy requirements and install Python packages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
COPY requirements.txt ./
|
| 17 |
COPY src/ ./src/
|
| 18 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 19 |
|
| 20 |
+
# Expose the Streamlit port
|
| 21 |
EXPOSE 8501
|
| 22 |
|
| 23 |
+
# Healthcheck to see if the app is responsive
|
| 24 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 25 |
|
| 26 |
# Command to run the Streamlit application
|