dsmueller commited on
Commit
b346950
1 Parent(s): 438e9d6

Refactor Dockerfile to create missing directories and update ownership

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -20,10 +20,15 @@ ENV HOME=/home/user \
20
  WORKDIR $HOME
21
 
22
  # Create directories for the app code to be copied into
23
- RUN mkdir -p $HOME/app
24
- RUN mkdir -p $HOME/src
25
- RUN mkdir -p $HOME/data
26
- RUN mkdir -p $HOME/config
 
 
 
 
 
27
 
28
  # Install Poetry
29
  RUN pip3 install poetry==1.7.1
@@ -46,7 +51,7 @@ RUN poetry install --no-root
46
 
47
  # Copy the rest of the repo into home
48
  RUN cp -R /clonedir/src /clonedir/data /clonedir/config /clonedir/app $HOME
49
- RUN chown -R user:user $HOME/src $HOME/data $HOME/config
50
 
51
  # Expose the port Streamlit runs on
52
  EXPOSE 8501
@@ -66,4 +71,4 @@ ENTRYPOINT ["streamlit", "run", "Home.py", "--server.port=8501", "--server.addre
66
 
67
  # To run remotely from hugging face spaces
68
  # docker run -it -p 7860:7860 --platform=linux/amd64 \
69
- # registry.hf.space/ai-aerospace-aerospace-chatbots:latest
 
20
  WORKDIR $HOME
21
 
22
  # Create directories for the app code to be copied into
23
+ RUN mkdir $HOME/app
24
+ RUN mkdir $HOME/src
25
+ RUN mkdir $HOME/data
26
+ RUN mkdir $HOME/config
27
+
28
+ # Check if /data directory exists, if not create a local db directory. Hugging face spaces has it by default, but not local docker.
29
+ RUN if [ ! -d "/data" ]; then \
30
+ mkdir $HOME/db; \
31
+ fi
32
 
33
  # Install Poetry
34
  RUN pip3 install poetry==1.7.1
 
51
 
52
  # Copy the rest of the repo into home
53
  RUN cp -R /clonedir/src /clonedir/data /clonedir/config /clonedir/app $HOME
54
+ RUN chown -R user:user $HOME/src $HOME/data $HOME/config $HOME/db
55
 
56
  # Expose the port Streamlit runs on
57
  EXPOSE 8501
 
71
 
72
  # To run remotely from hugging face spaces
73
  # docker run -it -p 7860:7860 --platform=linux/amd64 \
74
+ # registry.hf.space/ai-aerospace-aerospace-chatbots:latest