Update Dockerfile
Browse files- Dockerfile +11 -8
Dockerfile
CHANGED
|
@@ -3,30 +3,33 @@ FROM python:3.9-slim
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Install system dependencies
|
| 6 |
-
# ADDED libglib2.0-0 to fix the "libgthread" ImportError from OpenCV
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
libgl1-mesa-glx \
|
| 9 |
libglib2.0-0 \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
-
# Copy requirements and install
|
| 13 |
COPY requirements.txt ./
|
| 14 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
-
# Copy
|
| 17 |
-
COPY
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# --- User and Permission Setup ---
|
| 20 |
# Create a group and user
|
| 21 |
RUN groupadd --system appuser && useradd --system --gid appuser appuser
|
| 22 |
|
| 23 |
-
# Change ownership of the entire app directory
|
| 24 |
RUN chown -R appuser:appuser /app
|
| 25 |
|
| 26 |
-
# Set the HOME environment variable for the
|
| 27 |
ENV HOME=/app
|
| 28 |
|
| 29 |
-
# Switch to the non-root user
|
| 30 |
USER appuser
|
| 31 |
# --- End of User Setup ---
|
| 32 |
|
|
@@ -34,5 +37,5 @@ EXPOSE 8501
|
|
| 34 |
|
| 35 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 36 |
|
| 37 |
-
# Run the app
|
| 38 |
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false"]
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Install system dependencies
|
|
|
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
libgl1-mesa-glx \
|
| 8 |
libglib2.0-0 \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Copy the requirements file and install Python packages
|
| 12 |
COPY requirements.txt ./
|
| 13 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
+
# Copy ALL your application files from the root into the container's /app directory
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# --- NEW FIX for the Ultralytics Warning ---
|
| 19 |
+
# Create the .config directory so Ultralytics can write to it.
|
| 20 |
+
RUN mkdir -p /app/.config
|
| 21 |
|
| 22 |
# --- User and Permission Setup ---
|
| 23 |
# Create a group and user
|
| 24 |
RUN groupadd --system appuser && useradd --system --gid appuser appuser
|
| 25 |
|
| 26 |
+
# Change ownership of the entire app directory (including the new .config) to the user
|
| 27 |
RUN chown -R appuser:appuser /app
|
| 28 |
|
| 29 |
+
# Set the HOME environment variable for the user
|
| 30 |
ENV HOME=/app
|
| 31 |
|
| 32 |
+
# Switch to the non-root user
|
| 33 |
USER appuser
|
| 34 |
# --- End of User Setup ---
|
| 35 |
|
|
|
|
| 37 |
|
| 38 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
| 39 |
|
| 40 |
+
# Run the streamlit app from the root. No "src/" anymore.
|
| 41 |
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false"]
|