Samir433 commited on
Commit
8cfdb0a
·
verified ·
1 Parent(s): 682280f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -12
Dockerfile CHANGED
@@ -1,20 +1,37 @@
1
- FROM python:3.13.5-slim
 
2
 
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
 
 
13
 
14
- RUN pip3 install -r requirements.txt
 
 
 
 
15
 
16
- EXPOSE 8501
 
 
 
 
 
 
17
 
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
19
 
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
1
+ # Base image
2
+ FROM python:3.11
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Copy requirements
8
+ COPY ./requirements.txt /app/requirements.txt
 
 
 
9
 
10
+ # Upgrade pip and install dependencies
11
+ RUN pip3 install --no-cache-dir --upgrade pip
12
+ RUN pip3 install --no-cache-dir wheel setuptools build
13
+ RUN pip3 install --no-cache-dir --use-pep517 -r /app/requirements.txt
14
 
15
+ # Create a non-root user
16
+ RUN useradd -m -u 1000 user
17
+ USER user
18
+ ENV HOME /home/user
19
+ ENV PATH $HOME/.local/bin:$PATH
20
 
21
+ # Optional cache directories for HF models
22
+ ENV HF_HOME $HOME/.cache/huggingface
23
+ RUN mkdir -p $HF_HOME
24
+
25
+ # Set working directory for app
26
+ WORKDIR $HOME/app
27
+ COPY . $HOME/app
28
 
29
+ # Expose Streamlit default port
30
+ EXPOSE 8501
31
 
32
+ # Command to run Streamlit app
33
+ CMD streamlit run app.py \
34
+ --server.headless true \
35
+ --server.enableCORS false \
36
+ --server.enableXsrfProtection false \
37
+ --server.fileWatcherType none