From dc63fef002cf758bbbae16aad0731ac343fa399d Mon Sep 17 00:00:00 2001 From: Gustavo de Souza dos Reis Date: Wed, 19 Jun 2024 13:14:20 -0300 Subject: [PATCH] ioc: add support for installing packages with pip. --- Dockerfile | 9 +++++++++ README.md | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb6ce45..21c4ace 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ARG RUNDIR ARG ENTRYPOINT=/usr/local/bin/lnls-run ARG RUNTIME_PACKAGES ARG RUNTIME_TAR_PACKAGES +ARG RUNTIME_PIP_PACKAGES RUN apt update -y && \ apt install -y --no-install-recommends \ @@ -24,6 +25,13 @@ COPY --from=build-image /usr/local/lib /usr/local/lib COPY --from=build-image /usr/local/bin/lnls-get-n-unpack /usr/local/bin/lnls-get-n-unpack RUN lnls-get-n-unpack -r $RUNTIME_TAR_PACKAGES && \ ldconfig +RUN if [ -n "$RUNTIME_PIP_PACKAGES" ]; then \ + apt update && \ + apt install -y --no-install-recommends pip && \ + pip install $RUNTIME_PIP_PACKAGES; \ + apt clean && \ + rm -rf /var/lib/apt/lists/* + fi COPY --from=build-image /usr/local/bin/lnls-run /usr/local/bin/lnls-run @@ -44,6 +52,7 @@ FROM build-image AS build-stage ARG REPONAME ARG BUILD_PACKAGES ARG BUILD_TAR_PACKAGES +ARG BUILD_PIP_PACKAGES RUN if [ -n "$BUILD_PACKAGES" ]; then \ apt update && \ diff --git a/README.md b/README.md index 6bf8830..b8102da 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,9 @@ stages even when they are not needed. Additional build and runtime packages to be installed can be listed in `args`, under the `BUILD_PACKAGES` and `RUNTIME_PACKAGES` keys, respectively. It is not necessary to quote them - e.g. `BUILD_PACKAGES: python3 python3-requests`. -Packages essential to all (or most) IOCs should be added to [this repository's -`Dockerfile`](./Dockerfile). +Packages that strictly need to be installed via `pip` can be listed under the +`BUILD_PIP_PACKAGES` and `RUNTIME_PIP_PACKAGES` keys. Packages essential to all +(or most) IOCs should be added to [this repository's `Dockerfile`](./Dockerfile). The template above assumes the containers will be uploaded to the GitHub registry.