shingguy1 commited on
Commit
e56ca8b
·
verified ·
1 Parent(s): d81ae13

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -17
Dockerfile CHANGED
@@ -1,29 +1,29 @@
1
- # Use the same base image
2
- FROM python:3.9-slim
3
 
4
- # Set working directory to match the app structure
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- software-properties-common \
12
- git \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # Copy requirements and source files
16
- COPY requirements.txt ./
17
- COPY src/ ./src/
18
 
19
  # Install Python dependencies
20
- RUN pip3 install --no-cache-dir -r requirements.txt
21
 
22
- # Expose the Streamlit port
 
 
 
23
  EXPOSE 8501
24
 
25
- # Healthcheck for Spaces
26
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
27
 
28
- # Run Streamlit with XSRF protection disabled
29
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection", "false"]
 
1
+ # Use an official Python runtime as the base image
2
+ FROM python:3.11-slim
3
 
4
+ # Set working directory in the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies (for PIL and other libraries)
8
  RUN apt-get update && apt-get install -y \
9
+ libjpeg-dev \
10
+ zlib1g-dev \
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy requirements.txt to the working directory
14
+ COPY requirements.txt .
 
15
 
16
  # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the app files to the working directory
20
+ COPY app.py .
21
+
22
+ # Expose the port Streamlit uses
23
  EXPOSE 8501
24
 
25
+ # Set environment variables for Hugging Face token (optional, can be passed at runtime)
26
+ ENV HF_TOKEN=""
27
 
28
+ # Command to run the Streamlit app
29
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]