Spaces:
Sleeping
Sleeping
fix: Fix git not found
Browse files- Dockerfile +18 -13
Dockerfile
CHANGED
|
@@ -1,37 +1,42 @@
|
|
| 1 |
FROM python:3.11-slim-bookworm
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
COPY ./requirements.txt /code/requirements.txt
|
| 8 |
|
|
|
|
| 9 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
&& pip install .
|
| 14 |
-
|
| 15 |
-
RUN pip install -r transformers/examples/pytorch/speech-recognition/requirements.txt
|
| 16 |
|
|
|
|
| 17 |
RUN useradd -m -u 1000 user
|
| 18 |
|
| 19 |
USER user
|
| 20 |
|
| 21 |
ENV HOME=/home/user \
|
| 22 |
-
|
| 23 |
|
| 24 |
WORKDIR $HOME/app
|
| 25 |
|
| 26 |
RUN pip install --no-cache-dir --upgrade pip
|
| 27 |
|
| 28 |
-
USER root
|
| 29 |
-
RUN apt-get update && apt-get install -y ffmpeg
|
| 30 |
-
|
| 31 |
COPY --chown=user . $HOME/app
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
RUN git config --global --add safe.directory /home/user/app
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim-bookworm
|
| 2 |
|
| 3 |
+
# Install system dependencies (git + ffmpeg)
|
| 4 |
+
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y \
|
| 5 |
+
&& apt-get install -y --no-install-recommends git ffmpeg \
|
| 6 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
WORKDIR /code
|
| 9 |
|
| 10 |
COPY ./requirements.txt /code/requirements.txt
|
| 11 |
|
| 12 |
+
# Install Python requirements
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 14 |
|
| 15 |
+
# Clone transformers and install it
|
| 16 |
+
RUN git clone https://github.com/huggingface/transformers \
|
| 17 |
+
&& cd transformers && pip install . \
|
| 18 |
+
&& pip install -r examples/pytorch/speech-recognition/requirements.txt
|
|
|
|
| 19 |
|
| 20 |
+
# Create non-root user
|
| 21 |
RUN useradd -m -u 1000 user
|
| 22 |
|
| 23 |
USER user
|
| 24 |
|
| 25 |
ENV HOME=/home/user \
|
| 26 |
+
PATH=/home/user/.local/bin:$PATH
|
| 27 |
|
| 28 |
WORKDIR $HOME/app
|
| 29 |
|
| 30 |
RUN pip install --no-cache-dir --upgrade pip
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
COPY --chown=user . $HOME/app
|
| 33 |
|
| 34 |
+
USER root
|
| 35 |
+
|
| 36 |
+
# Configure Git safe directory
|
| 37 |
RUN git config --global --add safe.directory /home/user/app
|
| 38 |
|
| 39 |
+
# If you need secrets, handle them properly
|
| 40 |
+
# RUN --mount=type=secret,id=GENAI_API_KEY,mode=0444,required=true
|
| 41 |
+
|
| 42 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4"]
|