Skip to content

Commit

Permalink
Add support to package install with pip.
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 committed Jun 25, 2024
1 parent c82df1d commit 915891c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -24,6 +25,11 @@ 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; \
fi

COPY --from=build-image /usr/local/bin/lnls-run /usr/local/bin/lnls-run

Expand All @@ -44,12 +50,18 @@ 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 && \
apt install -y --no-install-recommends $BUILD_PACKAGES; \
fi
RUN lnls-get-n-unpack -r $BUILD_TAR_PACKAGES
RUN if [ -n "$BUILD_PIP_PACKAGES" ]; then \
apt update && \
apt install -y --no-install-recommends pip && \
pip install $BUILD_PIP_PACKAGES; \
fi

WORKDIR /opt/${REPONAME}

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 915891c

Please sign in to comment.