34 lines
813 B
Docker
34 lines
813 B
Docker
FROM python:3.10-slim as builder
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
RUN apt update && apt install git gcc libc6-dev -y --no-install-recommends && apt clean && rm -rf /var/lib/apt/lists/*
|
|
COPY requirements.txt .
|
|
RUN --mount=type=cache,target=/root/.cache/pip pip install Cython && \
|
|
pip wheel --no-deps --wheel-dir /app/wheels -r requirements.txt
|
|
|
|
|
|
|
|
FROM python:3.10-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
RUN useradd -ms /bin/bash silero_user && \
|
|
apt update && apt install ffmpeg -y --no-install-recommends && apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/wheels /wheels
|
|
COPY --from=builder /app/requirements.txt .
|
|
|
|
RUN pip install --no-cache /wheels/*
|
|
|
|
COPY . .
|
|
USER silero_user
|
|
|
|
CMD ["python3", "/app/main.py"]
|