ofermend commited on
Commit
1bcbb07
·
1 Parent(s): b2d6bf9

dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -12
Dockerfile CHANGED
@@ -1,23 +1,30 @@
1
  FROM python:3.11
2
 
3
- WORKDIR /app
4
-
5
- COPY ./requirements.txt /app/requirements.txt
6
-
7
- RUN pip3 install --no-cache-dir -r /app/requirements.txt
8
-
9
- # User
10
  RUN useradd -m -u 1000 user
11
- USER user
12
- ENV HOME /home/user
13
- ENV PATH $HOME/.local/bin:$PATH
 
 
14
 
15
  WORKDIR $HOME
16
- RUN mkdir app
17
- WORKDIR $HOME/app
 
 
 
 
 
18
  COPY . $HOME/app
 
19
 
 
 
20
  EXPOSE 8501
 
 
 
21
  CMD streamlit run app.py \
22
  --server.headless true \
23
  --server.enableCORS false \
 
1
  FROM python:3.11
2
 
3
+ # Create a non-root user
 
 
 
 
 
 
4
  RUN useradd -m -u 1000 user
5
+
6
+ # Set environment variables
7
+ ENV HOME=/home/user
8
+ ENV PATH=$HOME/.local/bin:$PATH
9
+ ENV NLTK_DATA=$HOME/nltk_data
10
 
11
  WORKDIR $HOME
12
+ RUN mkdir -p app
13
+ RUN mkdir -p $NLTK_DATA
14
+
15
+ # Install dependencies
16
+ COPY ./requirements.txt $HOME/app/requirements.txt
17
+ RUN pip3 install --no-cache-dir -r $HOME/app/requirements.txt
18
+
19
  COPY . $HOME/app
20
+ RUN python3 -c "import nltk; nltk.download('stopwords', download_dir='$NLTK_DATA')"
21
 
22
+ RUN chown -R user:user $HOME
23
+ USER user
24
  EXPOSE 8501
25
+
26
+ WORKDIR $HOME/app
27
+
28
  CMD streamlit run app.py \
29
  --server.headless true \
30
  --server.enableCORS false \