euler314 commited on
Commit
6102449
·
verified ·
1 Parent(s): 694915a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -15
Dockerfile CHANGED
@@ -1,33 +1,28 @@
1
- # Use a slim Python base image
2
  FROM python:3.9-slim
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies (including curl for the health check)
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
- curl \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy requirements to leverage Docker cache
14
- COPY requirements.txt .
15
 
16
  # Install Python dependencies
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy all application files (including app.py and the .streamlit folder)
20
- COPY . .
21
 
22
- # Expose the port that Streamlit uses (8501 for Hugging Face Spaces)
23
  EXPOSE 8501
24
 
25
- # Set environment variables so Streamlit is accessible externally
26
  ENV STREAMLIT_SERVER_PORT=8501
27
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
28
 
29
- # Health check to ensure the app is running
30
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
31
-
32
- # Run the Streamlit application from app.py
33
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
+ libeigen3-dev \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy all necessary files
12
+ COPY app.py cubic_cpp.cpp setup.py requirements.txt ./
13
 
14
  # Install Python dependencies
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Build C++ extension
18
+ RUN pip install -e .
19
 
20
+ # Expose Streamlit port
21
  EXPOSE 8501
22
 
23
+ # Set Streamlit environment variables
24
  ENV STREAMLIT_SERVER_PORT=8501
25
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
26
 
27
+ # Run the application
28
+ CMD ["streamlit", "run", "app.py"]