dtyago commited on
Commit
447bc57
1 Parent(s): acdfb5c

Set up Persistent volume properly

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -7
  2. entrypoint.sh +4 -0
Dockerfile CHANGED
@@ -17,13 +17,14 @@ ENV HOME=/home/user \
17
  HF_MODEL_NAME="BitBasher/llama-2-7b-mini-ibased-GGUF" \
18
  GGUF_MODEL_URL='https://huggingface.co/BitBasher/llama-2-7b-mini-ibased-GGUF/resolve/main/llama-2-7b-mini-ibased.Q5_K_M.gguf' \
19
  MODEL_CLASS='gguf' \
20
- CHROMADB_LOC='/home/user/data/chromadb'
 
21
 
22
  # Set the non-root user's home directory as the working directory
23
  WORKDIR $HOME
24
 
25
- # Create the /home/user/data directory and ensure it has the correct permissions
26
- RUN mkdir -p ./data && chown user:user ./data
27
 
28
  # Change to the non-root user
29
  USER user
@@ -34,7 +35,6 @@ COPY --chown=user:user requirements.txt $HOME/app/
34
  # Copy Static files for Jinja2 templates
35
  COPY --chown=user:user ./static /home/user/app/static
36
 
37
-
38
  # Install any needed packages specified in requirements.txt
39
  RUN pip install --no-cache-dir --user -r $HOME/app/requirements.txt
40
 
@@ -47,9 +47,6 @@ COPY --chown=user:user ./app .
47
  # Make port 7860 available to the world outside this container
48
  EXPOSE 7860
49
 
50
- # Indicate that a volume is expected at /home/user/data
51
- VOLUME /home/user/data
52
-
53
  # Adjust the COPY command for the entrypoint script to ensure correct placement
54
  COPY --chown=user:user entrypoint.sh /home/user/entrypoint.sh
55
 
 
17
  HF_MODEL_NAME="BitBasher/llama-2-7b-mini-ibased-GGUF" \
18
  GGUF_MODEL_URL='https://huggingface.co/BitBasher/llama-2-7b-mini-ibased-GGUF/resolve/main/llama-2-7b-mini-ibased.Q5_K_M.gguf' \
19
  MODEL_CLASS='gguf' \
20
+ CHROMADB_LOC='/home/user/data/chromadb' \
21
+ HF_HOME=/data/.huggingface
22
 
23
  # Set the non-root user's home directory as the working directory
24
  WORKDIR $HOME
25
 
26
+ # Correctly create a symbolic link from /data to /home/user/data
27
+ RUN ln -s /data /home/user/data
28
 
29
  # Change to the non-root user
30
  USER user
 
35
  # Copy Static files for Jinja2 templates
36
  COPY --chown=user:user ./static /home/user/app/static
37
 
 
38
  # Install any needed packages specified in requirements.txt
39
  RUN pip install --no-cache-dir --user -r $HOME/app/requirements.txt
40
 
 
47
  # Make port 7860 available to the world outside this container
48
  EXPOSE 7860
49
 
 
 
 
50
  # Adjust the COPY command for the entrypoint script to ensure correct placement
51
  COPY --chown=user:user entrypoint.sh /home/user/entrypoint.sh
52
 
entrypoint.sh CHANGED
@@ -2,6 +2,10 @@
2
 
3
  echo "Starting entrypoint script..."
4
 
 
 
 
 
5
  # Authenticate with Hugging Face
6
  export HF_HOME=/home/user/data/hf_cache
7
  echo "Using Hugging Face API token for authentication"
 
2
 
3
  echo "Starting entrypoint script..."
4
 
5
+ # Attempt to modify permissions of /data to ensure it's writable by the user
6
+ # Note: This might not work if /data's permissions are restricted outside the container
7
+ chown -R user:user /data
8
+
9
  # Authenticate with Hugging Face
10
  export HF_HOME=/home/user/data/hf_cache
11
  echo "Using Hugging Face API token for authentication"