Phani-ISB commited on
Commit
6281444
·
1 Parent(s): 81be6d1

Fix Dockerfile for HF Spaces

Browse files
Files changed (2) hide show
  1. DockerFile.txt +0 -26
  2. Dockerfile +21 -13
DockerFile.txt DELETED
@@ -1,26 +0,0 @@
1
- # Use official Python 3.11 image
2
- FROM python:3.11
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install OS dependencies (without software-properties-common)
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- git \
12
- apt-utils \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Copy requirements.txt and install Python packages
16
- COPY requirements.txt .
17
- RUN pip install --no-cache-dir -r requirements.txt
18
-
19
- # Copy all app files
20
- COPY . .
21
-
22
- # Expose Streamlit default port
23
- EXPOSE 8501
24
-
25
- # Run Streamlit app
26
- CMD ["streamlit", "run", "Graphs.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile CHANGED
@@ -1,21 +1,29 @@
1
- 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
- RUN pip3 install -r requirements.txt
 
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"]
 
 
1
+ # 1. Use a stable base image with Python 3.11 (not 3.13, to avoid package build issues)
2
+ FROM python:3.11-slim
 
3
 
4
+ # 2. Install system packages required for building Python libraries like pandas, plotly, etc.
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
+ gcc \
8
+ libpq-dev \
9
+ python3-dev && \
10
+ rm -rf /var/lib/apt/lists/*
11
 
 
 
12
 
13
+ # 3. Set the working directory inside the container to /app
14
+ WORKDIR /app
15
 
16
+ # 4. Copy all project files from the current host directory into the container's /app
17
+ COPY . /app
18
 
19
+ # 5. Upgrade pip, setuptools, and wheel to ensure compatibility with modern Python packaging (PEP 517/518)
20
+ RUN pip install --upgrade pip setuptools wheel
21
+
22
+ # 6. Install Python dependencies listed in requirements.txt
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # 7. Expose port 8501 so Docker knows your app runs on this port (Streamlit default)
26
+ EXPOSE 8501
27
 
28
+ # 8. Set the default command to run your Streamlit app when the container starts
29
+ CMD ["streamlit", "run", "Streamlit_Bank_Deployment.py", "--server.port=8501", "--server.address=0.0.0.0"]