imbecome commited on
Commit
b9e2031
·
verified ·
1 Parent(s): 436336f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -9
Dockerfile CHANGED
@@ -5,30 +5,33 @@ RUN apt-get update && apt-get install -y \
5
  curl ffmpeg git build-essential libgomp1 procps \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
- # 2. Install Ollama Binary dari GitHub (Lebih Stabil)
9
- # Kita gunakan flag -f agar curl gagal jika link-nya 404
10
- RUN curl -fL https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64 -o /usr/bin/ollama && \
11
  chmod +x /usr/bin/ollama
12
 
13
- # 3. Setup User & Directory
14
  RUN useradd -m -u 1000 user
15
  WORKDIR /home/user/app
16
 
17
- # 4. Install Requirements
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
22
- # 5. Copy & Permissions
23
  COPY --chown=user . .
 
 
 
24
  RUN mkdir -p /home/user/app/models_cache && \
25
  chown -R user:user /home/user/app && \
26
  chmod +x start.sh
27
 
28
- # 6. Pre-download static models
29
- ENV HF_HOME=/home/user/app/models_cache
 
 
30
  RUN python download_models.py
31
 
32
- USER user
33
  EXPOSE 7860
34
  CMD ["./start.sh"]
 
5
  curl ffmpeg git build-essential libgomp1 procps \
6
  && rm -rf /var/lib/apt/lists/*
7
 
8
+ # 2. Install Ollama Binary (Gunakan GitHub Official)
9
+ RUN curl -L https://github.com/ollama/ollama/releases/download/v0.5.11/ollama-linux-amd64 -o /usr/bin/ollama && \
 
10
  chmod +x /usr/bin/ollama
11
 
12
+ # 3. Setup User & Workdir
13
  RUN useradd -m -u 1000 user
14
  WORKDIR /home/user/app
15
 
16
+ # 4. Install Requirements (Sebagai Root agar Cache Stabil)
17
  COPY requirements.txt .
18
  RUN pip install --no-cache-dir --upgrade pip && \
19
  pip install --no-cache-dir -r requirements.txt
20
 
21
+ # 5. Copy Project Files
22
  COPY --chown=user . .
23
+
24
+ # 6. Fix Permissions (Crucial Step)
25
+ # Pastikan folder cache ada dan start.sh bisa dieksekusi
26
  RUN mkdir -p /home/user/app/models_cache && \
27
  chown -R user:user /home/user/app && \
28
  chmod +x start.sh
29
 
30
+ # 7. Jalankan Download Model (Static) sebagai USER
31
+ USER user
32
+ ENV TRANSFORMERS_CACHE=/home/user/app/models_cache \
33
+ HF_HOME=/home/user/app/models_cache
34
  RUN python download_models.py
35
 
 
36
  EXPOSE 7860
37
  CMD ["./start.sh"]