diff --git a/Dockerfile b/Dockerfile index 6f16b8bfe..79dbf7aa5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -93,6 +93,44 @@ CMD ["/usr/local/bin/libretime-analyzer"] ARG LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION +#======================================================================================# +# Playout # +#======================================================================================# +FROM python-base-ffmpeg as libretime-playout + +COPY tools/packages.py /tmp/packages.py +COPY playout/packages.ini /tmp/packages.ini + +RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + $(python3 /tmp/packages.py --format=line --exclude=python bullseye /tmp/packages.ini) \ + && rm -rf /var/lib/apt/lists/* \ + && rm -f /tmp/packages.py /tmp/packages.ini + +WORKDIR /src + +COPY playout/requirements.txt . +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --no-compile -r requirements.txt + +COPY --from=python-builder /build/shared/*.whl . +COPY --from=python-builder /build/api-client/*.whl . +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --no-compile *.whl && rm -Rf *.whl + +COPY playout . +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --editable . + +# Run +USER ${UID}:${GID} +WORKDIR /app + +CMD ["/usr/local/bin/libretime-playout"] + +ARG LIBRETIME_VERSION +ENV LIBRETIME_VERSION=$LIBRETIME_VERSION + #======================================================================================# # API # #======================================================================================# @@ -133,44 +171,6 @@ CMD ["/usr/local/bin/gunicorn", \ ARG LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION -#======================================================================================# -# Playout # -#======================================================================================# -FROM python-base-ffmpeg as libretime-playout - -COPY tools/packages.py /tmp/packages.py -COPY playout/packages.ini /tmp/packages.ini - -RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - $(python3 /tmp/packages.py --format=line --exclude=python bullseye /tmp/packages.ini) \ - && rm -rf /var/lib/apt/lists/* \ - && rm -f /tmp/packages.py /tmp/packages.ini - -WORKDIR /src - -COPY playout/requirements.txt . -RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --no-compile -r requirements.txt - -COPY --from=python-builder /build/shared/*.whl . -COPY --from=python-builder /build/api-client/*.whl . -RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --no-compile *.whl && rm -Rf *.whl - -COPY playout . -RUN --mount=type=cache,target=/root/.cache/pip \ - pip install --editable . - -# Run -USER ${UID}:${GID} -WORKDIR /app - -CMD ["/usr/local/bin/libretime-playout"] - -ARG LIBRETIME_VERSION -ENV LIBRETIME_VERSION=$LIBRETIME_VERSION - #======================================================================================# # Worker # #======================================================================================#