-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: add install-deps.sh script, use in docker
problem: it's easy to accidentally miss adding or removing a dependency in the various dockerfiles and the readme solution: much like core, encode them as a script, then use it
- Loading branch information
Showing
9 changed files
with
114 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
if test "$USER" != "flux"; then | ||
sudo groupadd -g $UID $USER | ||
sudo useradd -g $USER -u $UID -d /home/$USER -m $USER | ||
sudo sh -c "printf \"$USER ALL= NOPASSWD: ALL\\n\" >> /etc/sudoers" | ||
case "$ID" in | ||
ubuntu|debian) | ||
sudo adduser $USER sudo | ||
;; | ||
fedora|rocky|alma|rhel|centos|alpine) | ||
sudo usermod -G wheel $USER | ||
;; | ||
esac | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "$ID" ] ; then | ||
while IFS== read -r key value; do | ||
value="${value%\"}" | ||
value="${value#\"}" | ||
export "$key"="$value" | ||
done </etc/os-release | ||
fi | ||
|
||
PM="" | ||
case "$ID" in | ||
ubuntu|debian) | ||
PM=apt | ||
DEV_SUFFIX="-dev" | ||
DEV_SUFFIX_APT="-dev" | ||
PY3_PREFIX="python3-" | ||
LIB_PREFIX="lib" | ||
;; | ||
fedora|rocky|alma|rhel|centos) | ||
PM=dnf | ||
DEV_SUFFIX="-devel" | ||
PY3_PREFIX="python3-" | ||
LIB_PREFIX="" | ||
;; | ||
alpine) | ||
PM=apk | ||
DEV_SUFFIX="-dev" | ||
PY3_PREFIX="py3-" | ||
LIB_PREFIX="" | ||
;; | ||
esac | ||
|
||
[ -z "$PM" ] && echo Package manager for $ID is unknown && exit 1 | ||
|
||
pkglist=" | ||
${LIB_PREFIX}boost${DEV_SUFFIX} | ||
${LIB_PREFIX}boost-graph${DEV_SUFFIX_APT} | ||
libedit${DEV_SUFFIX} | ||
${LIB_PREFIX}hwloc${DEV_SUFFIX} | ||
${PY3_PREFIX}yaml | ||
${LIB_PREFIX}yaml-cpp${DEV_SUFFIX} | ||
ninja-build | ||
cmake | ||
curl | ||
bash | ||
jq | ||
valgrind | ||
" | ||
|
||
case $PM in | ||
apt) | ||
CMD="apt install ${@} ${pkglist}" | ||
;; | ||
apk) | ||
CMD="apk add ${@} ${pkglist}" | ||
;; | ||
dnf) | ||
CMD="dnf install ${@} ${pkglist}" | ||
;; | ||
esac | ||
echo will run "'$CMD'" | ||
if [ $(id -u) -ne 0 ] | ||
then echo command will not work without root, re-run as root | ||
exit 1 | ||
fi | ||
$CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,31 +5,15 @@ LABEL maintainer="Tom Scogland <[email protected]>" | |
ARG USER=flux | ||
ARG UID=1000 | ||
|
||
# copy scripts into image | ||
COPY scripts/ /scripts | ||
# Install flux-sched dependencies | ||
RUN sudo dnf -y install \ | ||
boost-devel \ | ||
boost-graph \ | ||
boost-system \ | ||
boost-filesystem \ | ||
boost-regex \ | ||
python3-pyyaml \ | ||
yaml-cpp-devel \ | ||
libedit-devel \ | ||
ninja-build \ | ||
cmake \ | ||
clang \ | ||
lcov \ | ||
RUN sudo /scripts/install-deps.sh -y \ | ||
&& sudo dnf clean all | ||
|
||
# Add configured user to image with sudo access: | ||
# | ||
RUN \ | ||
if test "$USER" != "flux"; then \ | ||
sudo groupadd -g $UID $USER \ | ||
&& sudo useradd -g $USER -u $UID -d /home/$USER -m $USER \ | ||
&& sudo sh -c "printf \"$USER ALL= NOPASSWD: ALL\\n\" >> /etc/sudoers" \ | ||
&& sudo usermod -G wheel $USER; \ | ||
fi | ||
RUN /scripts/add_docker_user.sh | ||
|
||
USER $USER | ||
WORKDIR /home/$USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters