Install python packages from ubuntu's repositories

Also reduces image size by updating, installing and cleaning
packages in one single step
This commit is contained in:
Carlos Álvaro
2019-02-23 17:07:00 +01:00
parent 6489ae809d
commit ac9b1bb3cd
2 changed files with 30 additions and 41 deletions

View File

@@ -6,11 +6,12 @@ source ${SALT_BUILD_DIR}/functions.sh
# Install build dependencies
echo "Installing dependencies ..."
BUILD_DEPENDENCIES="gnupg git cmake gcc g++ make \
BUILD_DEPENDENCIES="cmake gcc g++ make \
libhttp-parser-dev libssl-dev zlib1g-dev \
libzmq-dev libcurl4-openssl-dev libffi-dev"
libcurl4-openssl-dev libffi-dev swig"
apt-get install --yes --quiet --no-install-recommends ${BUILD_DEPENDENCIES}
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends ${BUILD_DEPENDENCIES}
# Create salt user
echo "Creating ${SALT_USER} user ..."
@@ -37,20 +38,6 @@ cd libgit2-${LIBGIT2_VERSION}/
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_CLAR=OFF -DTHREADSAFE=ON .
cmake --build . --target install
# Install python packages
echo "Installing python packages ..."
pip3 install "pygit2==v${PYGIT2_VERSION}" \
"gitpython==v${GITPYTHON_VERSION}" \
"M2Crypto==v${M2CRYPTO_VERSION}" \
"Mako==v${MAKO_VERSION}" \
"pycryptodome==v${PYCRYPTODOME_VERSION}" \
"libnacl==v${LIBNACL_VERSION}" \
"raet==v${RAET_VERSION}" \
"CherryPy==v${CHERRYPY_VERSION}" \
"timelib==v${TIMELIB_VERSION}" \
"docker-py==v${DOCKERPY_VERSION}" \
"msgpack-pure==v${MSGPACKPURE_VERSION}"
# Bootstrap script options:
# https://docs.saltstack.com/en/latest/topics/tutorials/salt_bootstrap.html#command-line-options
## -M: install Salt Master by default
@@ -65,6 +52,18 @@ wget -O bootstrap-salt.sh https://bootstrap.saltstack.com
sh bootstrap-salt.sh ${SALT_BOOTSTRAP_OPTS} git v${SALT_VERSION}
chown -R ${SALT_USER}: ${SALT_ROOT_DIR}
# Install python3 packages
echo "Installing python3 packages ..."
DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
python3-mako python3-pycryptodome python3-cherrypy3 python3-git python3-u-msgpack \
python3-ioflo python3-redis python3-gnupg python3-mysqldb python3-dateutil python3-timelib \
python3-raet python3-libnacl
# Install pip3 python packages
echo "Installing pip3 python packages ..."
pip3 install "pygit2==v${PYGIT2_VERSION}" \
"M2Crypto==v${M2CRYPTO_VERSION}"
# Configure ssh
echo "Configuring ssh ..."
sed -i -e "s|^[# ]*StrictHostKeyChecking.*$| StrictHostKeyChecking no|" /etc/ssh/ssh_config
@@ -111,3 +110,7 @@ autorestart=true
stdout_logfile=${SALT_LOGS_DIR}/supervisor/%(program_name)s.log
stderr_logfile=${SALT_LOGS_DIR}/supervisor/%(program_name)s.log
EOF
# purge build dependencies and cleanup apt
DEBIAN_FRONTEND=noninteractive apt-get clean --yes
rm -rf /var/lib/apt/lists/*