Spaces:
Runtime error
Runtime error
update dockerfile
Browse files- Dockerfile +10 -5
Dockerfile
CHANGED
|
@@ -1,13 +1,17 @@
|
|
| 1 |
# Use Ubuntu 22.04 as a public base image to avoid GHCR permissions
|
| 2 |
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
-
# Disable interactive prompts and
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV TZ=Etc/UTC
|
| 7 |
|
| 8 |
-
# Use bash with strict modes for debugging
|
| 9 |
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# 1. Install OS-level dependencies
|
| 12 |
RUN echo "### STEP 1: Installing OS-level dependencies" && \
|
| 13 |
apt-get update && \
|
|
@@ -21,12 +25,13 @@ RUN echo "### STEP 1: Installing OS-level dependencies" && \
|
|
| 21 |
python3-opencv && \
|
| 22 |
rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
-
# 2. Prepare
|
| 25 |
RUN echo "### STEP 2: Preparing application directory"
|
| 26 |
WORKDIR /app
|
| 27 |
COPY requirements.txt ./
|
|
|
|
| 28 |
COPY app.py ./
|
| 29 |
-
#
|
| 30 |
|
| 31 |
# 3. Install Python dependencies (excluding llama-cpp-python)
|
| 32 |
RUN echo "### STEP 3: Installing Python dependencies" && \
|
|
@@ -38,7 +43,7 @@ RUN echo "### STEP 4: Building and installing llama-cpp-python with OpenBLAS" &&
|
|
| 38 |
export CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" && \
|
| 39 |
pip3 install --no-cache-dir --force-reinstall --no-binary llama-cpp-python llama-cpp-python
|
| 40 |
|
| 41 |
-
# 5.
|
| 42 |
RUN echo "### STEP 5: Finalizing Docker image"
|
| 43 |
EXPOSE 7860
|
| 44 |
CMD ["python3", "app.py"]
|
|
|
|
| 1 |
# Use Ubuntu 22.04 as a public base image to avoid GHCR permissions
|
| 2 |
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
+
# Disable interactive prompts and preconfigure timezone
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV TZ=Etc/UTC
|
| 7 |
|
|
|
|
| 8 |
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
|
| 9 |
|
| 10 |
+
# Preseed tzdata to avoid interactive prompt
|
| 11 |
+
RUN echo "tzdata tzdata/Areas select Etc" > /tmp/tzdata.seed && \
|
| 12 |
+
echo "tzdata tzdata/Zones/Etc select UTC" >> /tmp/tzdata.seed && \
|
| 13 |
+
debconf-set-selections /tmp/tzdata.seed
|
| 14 |
+
|
| 15 |
# 1. Install OS-level dependencies
|
| 16 |
RUN echo "### STEP 1: Installing OS-level dependencies" && \
|
| 17 |
apt-get update && \
|
|
|
|
| 25 |
python3-opencv && \
|
| 26 |
rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
+
# 2. Prepare application directory and copy code
|
| 29 |
RUN echo "### STEP 2: Preparing application directory"
|
| 30 |
WORKDIR /app
|
| 31 |
COPY requirements.txt ./
|
| 32 |
+
COPY packages.txt ./
|
| 33 |
COPY app.py ./
|
| 34 |
+
# COPY any other source files or directories as needed
|
| 35 |
|
| 36 |
# 3. Install Python dependencies (excluding llama-cpp-python)
|
| 37 |
RUN echo "### STEP 3: Installing Python dependencies" && \
|
|
|
|
| 43 |
export CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" && \
|
| 44 |
pip3 install --no-cache-dir --force-reinstall --no-binary llama-cpp-python llama-cpp-python
|
| 45 |
|
| 46 |
+
# 5. Finalize and launch
|
| 47 |
RUN echo "### STEP 5: Finalizing Docker image"
|
| 48 |
EXPOSE 7860
|
| 49 |
CMD ["python3", "app.py"]
|