Abs6187 commited on
Commit
bbc9bc6
·
verified ·
1 Parent(s): 07ddc04

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -18
Dockerfile CHANGED
@@ -1,8 +1,8 @@
1
- FROM python:3.13.5-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install OS-level dependencies including ffmpeg and OpenCV requirements
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
@@ -16,24 +16,26 @@ RUN apt-get update && apt-get install -y \
16
  libglib2.0-0 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Copy dependency spec and source code
20
- COPY requirements.txt ./
21
- COPY . ./
22
 
23
- # Install Python dependencies
24
- RUN pip3 install --no-cache-dir -r requirements.txt
25
 
26
- # Set environment variables for Streamlit and Keras
27
- ENV STREAMLIT_HOME=/tmp/.streamlit
28
- ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
29
- ENV KERAS_BACKEND=torch
30
- ENV OPENCV_LOG_LEVEL=ERROR
31
 
32
- # Expose the port used by Streamlit
33
- EXPOSE 8501
 
 
 
 
 
 
34
 
35
- # Healthcheck: test whether Streamlit's health endpoint is alive
36
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
37
 
38
- # Launch Streamlit app; bind to 0.0.0.0 so external connections work
39
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
 
16
  libglib2.0-0 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Copy requirements first for better caching
20
+ COPY requirements.txt .
 
21
 
22
+ # Install PyTorch CPU version first
23
+ RUN pip install --no-cache-dir torch==2.0.1+cpu --index-url https://download.pytorch.org/whl/cpu
24
 
25
+ # Install other Python dependencies
26
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
27
 
28
+ # Copy application code
29
+ COPY . .
30
+
31
+ # Set environment variables
32
+ ENV PYTHONUNBUFFERED=1
33
+ ENV STREAMLIT_SERVER_HEADLESS=true
34
+ ENV STREAMLIT_SERVER_ENABLE_CORS=false
35
+ ENV STREAMLIT_SERVER_PORT=8501
36
 
37
+ # Expose port
38
+ EXPOSE 8501
39
 
40
+ # Run the app
41
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]