imbecome commited on
Commit
a2fb242
·
verified ·
1 Parent(s): 1271a1e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -6
Dockerfile CHANGED
@@ -4,27 +4,39 @@ RUN apt-get update && apt-get install -y \
4
  curl ffmpeg git build-essential libgomp1 procps \
5
  && rm -rf /var/lib/apt/lists/*
6
 
7
- # Ganti bagian instalasi Ollama lama dengan ini:
8
  RUN curl -fsSL https://ollama.com/install.sh | sh
9
 
10
- # Pastikan izin akses benar untuk user 1000
11
- RUN chown -R user:user /usr/bin/ollama
12
-
13
  RUN useradd -m -u 1000 user
 
 
14
  WORKDIR /home/user/app
15
 
 
16
  COPY requirements.txt .
 
 
17
  RUN pip install --no-cache-dir --upgrade pip && \
18
  pip install --no-cache-dir -r requirements.txt
19
 
20
- COPY --chown=user . .
 
 
 
21
  RUN mkdir -p /home/user/app/models_cache && \
22
  chown -R user:user /home/user/app && \
23
  chmod +x start.sh
24
 
25
- USER user
26
  ENV HF_HOME=/home/user/app/models_cache
 
 
 
 
 
27
  RUN python download_models.py
28
 
29
  EXPOSE 7860
 
30
  CMD ["./start.sh"]
 
4
  curl ffmpeg git build-essential libgomp1 procps \
5
  && rm -rf /var/lib/apt/lists/*
6
 
7
+ # install ollama
8
  RUN curl -fsSL https://ollama.com/install.sh | sh
9
 
10
+ # buat user dulu
 
 
11
  RUN useradd -m -u 1000 user
12
+
13
+ # set working directory
14
  WORKDIR /home/user/app
15
 
16
+ # copy requirements
17
  COPY requirements.txt .
18
+
19
+ # install python deps
20
  RUN pip install --no-cache-dir --upgrade pip && \
21
  pip install --no-cache-dir -r requirements.txt
22
 
23
+ # copy project
24
+ COPY --chown=user:user . .
25
+
26
+ # buat cache model
27
  RUN mkdir -p /home/user/app/models_cache && \
28
  chown -R user:user /home/user/app && \
29
  chmod +x start.sh
30
 
31
+ # set env
32
  ENV HF_HOME=/home/user/app/models_cache
33
+
34
+ # ganti ke user non root
35
+ USER user
36
+
37
+ # download model
38
  RUN python download_models.py
39
 
40
  EXPOSE 7860
41
+
42
  CMD ["./start.sh"]