shingguy1 commited on
Commit
3812afd
·
verified ·
1 Parent(s): 5a3622a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -12
Dockerfile CHANGED
@@ -1,25 +1,31 @@
1
- FROM python:3.11-slim
 
2
 
3
- WORKDIR /app
4
-
5
- # Install system libraries required by PIL (Pillow) and Streamlit
6
  RUN apt-get update && apt-get install -y \
7
- libjpeg-dev \
8
  libpng-dev \
9
- libtiff-dev \
10
- libopenjp2-7 \
11
- libfreetype6-dev \
12
- zlib1g-dev \
13
- fonts-dejavu-core \
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
 
 
 
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
 
19
  COPY src/streamlit_app.py .
20
 
 
 
 
 
21
  EXPOSE 8501
22
 
23
- ENV HF_TOKEN=""
 
24
 
25
- CMD ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection", "false"]
 
 
1
+ # Use a Python slim base image with necessary system dependencies
2
+ FROM python:3.10-slim
3
 
4
+ # Install system dependencies for pillow and general compatibility
 
 
5
  RUN apt-get update && apt-get install -y \
 
6
  libpng-dev \
7
+ libjpeg-dev \
8
+ gcc \
 
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Set working directory
12
+ WORKDIR /app
13
+
14
+ # Copy requirements and install dependencies
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Copy the app script
19
  COPY src/streamlit_app.py .
20
 
21
+ # Create cache directory with write permissions
22
+ RUN mkdir -p /tmp/cache && chmod -R 777 /tmp/cache
23
+
24
+ # Expose Streamlit's default port
25
  EXPOSE 8501
26
 
27
+ # Set environment variable for Hugging Face cache
28
+ ENV HUGGINGFACE_HUB_CACHE=/tmp/cache
29
 
30
+ # Run Streamlit with increased upload size limit (1GB)
31
+ CMD ["streamlit", "run", "app.py", "--server.maxUploadSize=1000", "--server.port=8501"]