Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +7 -15
Dockerfile
CHANGED
|
@@ -1,32 +1,24 @@
|
|
| 1 |
-
FROM python:3.10
|
| 2 |
|
| 3 |
-
# Install git and ffmpeg
|
| 4 |
-
RUN
|
| 5 |
|
| 6 |
-
# Create
|
| 7 |
-
RUN
|
| 8 |
ENV HOME=/home/user
|
| 9 |
USER user
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
# Receive Git URL from build argument
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
RUN --mount=type=secret,id=URL,mode=0444,required=true \
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
# Set up virtual environment and dependencies
|
| 22 |
RUN python -m venv shared_venv && \
|
| 23 |
shared_venv/bin/pip install --upgrade pip && \
|
| 24 |
shared_venv/bin/pip install --no-cache-dir -r requirements.txt && \
|
| 25 |
-
shared_venv/bin/pip install --no-cache-dir numpy opencv-python-headless
|
| 26 |
shared_venv/bin/python -m pip list > /app/pip_list.txt
|
| 27 |
|
| 28 |
-
# Ensure permissions
|
| 29 |
-
RUN chown -R user:user /app
|
| 30 |
-
|
| 31 |
EXPOSE 7860
|
| 32 |
CMD ["shared_venv/bin/python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
+
# Install git and ffmpeg using apk (Alpine's package manager)
|
| 4 |
+
RUN apk add --no-cache git ffmpeg
|
| 5 |
|
| 6 |
+
# Create non-root user
|
| 7 |
+
RUN adduser -D -u 1000 user
|
| 8 |
ENV HOME=/home/user
|
| 9 |
USER user
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
# Receive Git URL from build argument
|
|
|
|
|
|
|
|
|
|
| 13 |
RUN --mount=type=secret,id=URL,mode=0444,required=true \
|
| 14 |
+
git clone https://$(cat /run/secrets/URL) .
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Set up virtual environment and dependencies
|
| 17 |
RUN python -m venv shared_venv && \
|
| 18 |
shared_venv/bin/pip install --upgrade pip && \
|
| 19 |
shared_venv/bin/pip install --no-cache-dir -r requirements.txt && \
|
| 20 |
+
shared_venv/bin/pip install --no-cache-dir numpy opencv-python-headless && \
|
| 21 |
shared_venv/bin/python -m pip list > /app/pip_list.txt
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
EXPOSE 7860
|
| 24 |
CMD ["shared_venv/bin/python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|