Spaces:
Sleeping
Sleeping
Regino
commited on
Commit
Β·
95a3efa
1
Parent(s):
3474ac6
fixed docker
Browse files- Dockerfile +30 -2
Dockerfile
CHANGED
@@ -2,20 +2,48 @@ FROM python:3.9-slim
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
build-essential \
|
7 |
curl \
|
8 |
software-properties-common \
|
9 |
git \
|
|
|
|
|
|
|
|
|
|
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
|
|
12 |
COPY requirements.txt ./
|
13 |
-
COPY src/ ./src/
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
EXPOSE 8501
|
18 |
|
19 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
20 |
|
|
|
|
|
21 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Install system dependencies required by OpenCV and other build tools
|
6 |
+
# libgl1-mesa-glx: Provides libGL.so.1 (OpenGL library) - THIS IS THE KEY FIX
|
7 |
+
# libsm6, libxrender1: Common X11 dependencies often needed by OpenCV
|
8 |
+
# ffmpeg: Good for general video processing capabilities
|
9 |
+
# build-essential, curl, software-properties-common, git: Keep your existing dev tools
|
10 |
RUN apt-get update && apt-get install -y \
|
11 |
build-essential \
|
12 |
curl \
|
13 |
software-properties-common \
|
14 |
git \
|
15 |
+
libgl1-mesa-glx \
|
16 |
+
libsm6 \
|
17 |
+
libxrender1 \
|
18 |
+
ffmpeg \
|
19 |
+
# Clean up apt caches to reduce image size
|
20 |
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# Copy your requirements.txt file
|
23 |
COPY requirements.txt ./
|
|
|
24 |
|
25 |
+
# Install Python dependencies from requirements.txt
|
26 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
27 |
+
|
28 |
+
# Copy your application source code and assets
|
29 |
+
# This assumes your project structure looks something like this:
|
30 |
+
# project_root/
|
31 |
+
# βββ src/
|
32 |
+
# β βββ streamlit_app.py (your app.py renamed/moved to here)
|
33 |
+
# βββ models/
|
34 |
+
# β βββ emotion_model_best.h5
|
35 |
+
# βββ cascades/
|
36 |
+
# β βββ haarcascade_frontalface_default.xml
|
37 |
+
# βββ requirements.txt
|
38 |
+
# βββ Dockerfile
|
39 |
+
#
|
40 |
+
# COPY . . copies everything from your project_root into /app in the container.
|
41 |
+
COPY . .
|
42 |
|
43 |
EXPOSE 8501
|
44 |
|
45 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
46 |
|
47 |
+
# Ensure the entrypoint path is correct for your app within the container
|
48 |
+
# Based on your structure, it's inside 'src/'
|
49 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|