Trigger82 commited on
Commit
e05c01d
·
verified ·
1 Parent(s): 0ff477a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -7
Dockerfile CHANGED
@@ -1,11 +1,31 @@
1
- FROM python:3.10-slim
2
 
3
- RUN apt update && apt install -y git && rm -rf /var/lib/apt/lists/*
4
- WORKDIR /app
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  EXPOSE 7860
11
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.11
2
 
 
 
 
 
3
 
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV HOME=/home/user PATH=$HOME/.local/bin:$PATH
7
+
8
+
9
+ RUN mkdir -p $HOME/.cache/huggingface
10
+ ENV HF_HOME=$HOME/.cache/huggingface
11
+ WORKDIR $HOME/app
12
+
13
+
14
+ COPY --chown=user requirements.txt .
15
+ RUN pip install --no-cache-dir --upgrade pip \
16
+ && pip install --no-cache-dir -r requirements.txt
17
+
18
+
19
+ RUN pip install --no-cache-dir huggingface_hub \
20
+ && python3 - << 'EOF'
21
+ import os
22
+ from huggingface_hub import snapshot_download
23
+ cache_dir = os.environ.get("HF_HOME", os.path.expanduser("~/.cache/huggingface"))
24
+ snapshot_download("rasyosef/Phi-1_5-Instruct-v0.1", cache_dir=cache_dir)
25
+ EOF
26
+
27
+
28
+ COPY --chown=user . .
29
 
30
  EXPOSE 7860
31
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]