Update Dockerfile
Browse files- 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
|
| 9 |
-
|
| 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 &
|
| 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
|
| 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 |
-
#
|
| 29 |
-
|
|
|
|
|
|
|
| 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"]
|