fastcapt / Dockerfile
deepak191z's picture
Update Dockerfile
4ee5e7c verified
raw
history blame
817 Bytes
FROM python:3.10-alpine
# Install git and ffmpeg using apk (Alpine's package manager)
RUN apk add --no-cache git ffmpeg
# Create non-root user
RUN adduser -D -u 1000 user
ENV HOME=/home/user
USER user
WORKDIR /app
# Receive Git URL from build argument
RUN --mount=type=secret,id=URL,mode=0444,required=true \
git clone https://$(cat /run/secrets/URL) .
# Set up virtual environment and dependencies
RUN python -m venv shared_venv && \
shared_venv/bin/pip install --upgrade pip && \
shared_venv/bin/pip install --no-cache-dir -r requirements.txt && \
shared_venv/bin/pip install --no-cache-dir numpy opencv-python-headless && \
shared_venv/bin/python -m pip list > /app/pip_list.txt
EXPOSE 7860
CMD ["shared_venv/bin/python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]