Improvements docker image building

This commit is contained in:
Mirco 2023-12-07 20:38:43 +01:00
parent d90f68ce1a
commit 9638450ef6
16 changed files with 136 additions and 55 deletions

View file

@ -1,4 +1,4 @@
FROM node:lts-bookworm-slim FROM node:lts-bookworm-slim
ADD resources /tmp ADD resources /tmp
RUN /tmp/install.sh RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh

View file

@ -1 +0,0 @@
478604fe85c711aafe8ef78c0bf25cb93fa46de5a3c07040f25a595096c43f8a kubeconform-v0.6.3.tar.gz

View file

@ -1,31 +1,47 @@
#!/bin/bash #!/bin/bash
set -eux set -exo pipefail
function main() { function main() {
{
upgradeSystem upgradeSystem
mkdir -p /usr/share/man/man1 mkdir -p /usr/share/man/man1
apt -qqy install openjdk-17-jre-headless leiningen curl apt-get -qqy install openjdk-17-jre-headless leiningen curl
# shadow-cljs # shadow-cljs
npm install -g npm
npm install -g --save-dev shadow-cljs npm install -g --save-dev shadow-cljs
# download kubeconform & graalvm # download kubeconform & graalvm
curl -Lo /tmp/kubeconform-v0.6.3.tar.gz https://github.com/yannh/kubeconform/releases/download/v0.6.3/kubeconform-linux-amd64.tar.gz kubeconform_version="0.6.4"
# checksum curl -SsLo /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/kubeconform-linux-amd64.tar.gz
cd /tmp curl -SsLo /tmp/CHECKSUMS https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/CHECKSUMS
sha256sum --check CHECKSUMS
# checksum kubeconform
checksum
# install kubeconform # install kubeconform
tar -xf /tmp/kubeconform-v0.6.3.tar.gz tar -C /usr/local/bin -xf /tmp/kubeconform.tar.gz --exclude=LICENSE
cp kubeconform /usr/local/bin
#install pyb #install pyb
apt -qqy install python3 python3-pip git; apt-get -qqy install python3 python3-pip git
pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages; pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages
cleanupDocker cleanupDocker
} > /dev/null
}
function checksum() {
checksum_var=$(awk '{print $1}' /tmp/CHECKSUMS|sed -n '2p')
sha256sum_var=$(sha256sum /tmp/kubeconform.tar.gz|awk '{print $1}')
if [ $checksum_var == $sha256sum_var ]; then
echo "Kubeconform checksum verification succesful"
else
echo "Failure in kubeconform checksum verification"
exit 1
fi
} }
source /tmp/install_functions.sh source /tmp/install_functions.sh

View file

@ -1,6 +1,6 @@
FROM debian:stable-slim FROM debian:stable-slim
ADD resources /tmp ADD resources /tmp
RUN /tmp/install.sh RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh
ENV LANG=en_US.UTF-8 \ ENV LANG=en_US.UTF-8 \
JAVA_HOME=/usr/lib64/graalvm/graalvm-community-java17 JAVA_HOME=/usr/lib64/graalvm/graalvm-community-java17

View file

@ -1,2 +0,0 @@
478604fe85c711aafe8ef78c0bf25cb93fa46de5a3c07040f25a595096c43f8a kubeconform-v0.6.3.tar.gz
094e5a7dcc4a903b70741d5c3c1688f83e83e2d44eb3d8d798c5d79ed902032c graalvm-community-jdk-17.0.7_linux-x64_bin.tar.gz

View file

@ -1,37 +1,57 @@
#!/bin/bash #!/bin/bash
set -eux set -exo pipefail
function main() { function main() {
{
upgradeSystem upgradeSystem
apt -qqy install curl git openjdk-17-jre-headless leiningen build-essential libz-dev zlib1g-dev; apt-get -qqy install curl git openjdk-17-jre-headless leiningen build-essential libz-dev zlib1g-dev
# download kubeconform & graalvm # download kubeconform & graalvm
curl -Lo /tmp/kubeconform-v0.6.3.tar.gz https://github.com/yannh/kubeconform/releases/download/v0.6.3/kubeconform-linux-amd64.tar.gz kubeconform_version="0.6.4"
curl -Lo /tmp/graalvm-community-jdk-17.0.7_linux-x64_bin.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.7/graalvm-community-jdk-17.0.7_linux-x64_bin.tar.gz graalvm_jdk_version="17.0.9"
# checksum curl -SsLo /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/kubeconform-linux-amd64.tar.gz
cd /tmp curl -SsLo /tmp/CHECKSUMS https://github.com/yannh/kubeconform/releases/download/v${kubeconform_version}/CHECKSUMS
sha256sum --check CHECKSUMS curl -SsLo /tmp/graalvm-community-jdk.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz
curl -SsLo /tmp/graalvm-checksum https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${graalvm_jdk_version}/graalvm-community-jdk-${graalvm_jdk_version}_linux-x64_bin.tar.gz.sha256
# checksum kubeconform & graalvm-jdk
checksum
# install kubeconform # install kubeconform
tar -xf /tmp/kubeconform-v0.6.3.tar.gz tar -C /usr/local/bin -xf /tmp/kubeconform.tar.gz --exclude=LICENSE
cp kubeconform /usr/local/bin
# install graalvm # install graalvm
tar -xzf graalvm-community-jdk-17.0.7_linux-x64_bin.tar.gz tar -C /usr/lib/jvm/ -xf /tmp/graalvm-community-jdk.tar.gz
mv graalvm-community-openjdk-17.0.7+7.1 /usr/lib/jvm/ dirname_graalvm=$(ls /usr/lib/jvm/|grep -e graa)
ln -s /usr/lib/jvm/graalvm-community-openjdk-17.0.7+7.1 /usr/lib/jvm/graalvm ln -s /usr/lib/jvm/$dirname_graalvm /usr/lib/jvm/graalvm
ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2 update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
gu install native-image gu install native-image
ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
#install pyb #install pyb
apt -qqy install python3 python3-pip; apt-get -qqy install python3 python3-pip
pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages; pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages
cleanupDocker cleanupDocker
} > /dev/null
}
function checksum() {
checksum_kubeconform=$(awk '{print $1}' /tmp/CHECKSUMS|sed -n '2p')
sha256sum_kubeconform=$(sha256sum /tmp/kubeconform.tar.gz|awk '{print $1}')
checksum_graalvm_jdk=$(awk '{print $1}' /tmp/graalvm-checksum)
sha256sum_graalvm_jdk=$(sha256sum /tmp/graalvm-community-jdk.tar.gz|awk '{print $1}')
if [ $checksum_kubeconform == $sha256sum_kubeconform -a $checksum_graalvm_jdk == $sha256sum_graalvm_jdk ]; then
echo "Kubeconform & graalvm_jdk checksum verification succesful"
else
echo "Failure in kubeconform|graalvm_jdk checksum verification"
exit 1
fi
} }
source /tmp/install_functions.sh source /tmp/install_functions.sh

View file

@ -26,7 +26,7 @@ def initialize(project):
"image_tag": f"{image_tag}", "image_tag": f"{image_tag}",
} }
project.build_depends_on("ddadevops>=4.0.0") project.build_depends_on("ddadevops>=4.9.0")
build = DevopsImageBuild(project, input) build = DevopsImageBuild(project, input)
build.initialize_build_dir() build.initialize_build_dir()

View file

@ -1,6 +1,5 @@
FROM python:3.10-alpine FROM python:3.10-alpine
RUN set -eux; WORKDIR /tmp
RUN apk add --no-cache python3 py3-pip openssl-dev bash git curl; ADD resources ./
RUN python3 -m pip install -U pip; RUN ./install.sh
RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection;

View file

@ -0,0 +1,17 @@
#!/bin/sh
set -exo pipefail
function main() {
{
apk -U upgrade
apk add --no-cache python3 py3-pip openssl-dev bash git curl
python3 -m pip install -U pip
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection
apk cache clean
} > /dev/null
rm -rf /tmp/*
}
main

View file

@ -1,6 +1,5 @@
FROM docker:latest FROM docker:latest
RUN set -eux; WORKDIR /tmp
RUN apk add --no-cache python3 py3-pip openssl-dev bash git; ADD resources ./
RUN python3 -m pip install -U pip; RUN ./install.sh
RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection;

View file

@ -0,0 +1,17 @@
#!/bin/sh
set -exo pipefail
function main() {
{
apk -U upgrade
apk add --no-cache python3 py3-pip openssl-dev bash git
python3 -m pip install -U pip
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection
apk cache clean
} > /dev/null
rm -rf /tmp/*
}
main

View file

@ -1,4 +1,4 @@
FROM debian:stable-slim FROM debian:stable-slim
ADD resources /tmp ADD resources /tmp
RUN /tmp/install.sh RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh

View file

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
set -eux set -exo pipefail
function main() { function main() {
{
upgradeSystem upgradeSystem
apt -qqy install curl git kotlin gradle iputils-ping ssh apt-get -qqy install curl git kotlin gradle iputils-ping ssh python3 python3-pip
#install pyb pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages
apt -qqy install python3 python3-pip;
pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages;
cleanupDocker cleanupDocker
} > /dev/null
} }
source /tmp/install_functions.sh source /tmp/install_functions.sh

View file

@ -1,7 +1,5 @@
FROM python:3.10-alpine FROM python:3.10-alpine
RUN set -eux; WORKDIR /tmp
RUN apk add --no-cache build-base rust python3 python3-dev py3-pip py3-setuptools py3-wheel libffi-dev openssl-dev cargo bash git curl; ADD resources ./
RUN python3 -m pip install -U pip; RUN ./install.sh
RUN pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection;
RUN pip3 install coverage flake8 flake8-polyfill mypy mypy-extensions pycodestyle pyflakes pylint pytest pytest-cov pytest-datafiles types-setuptools types-PyYAML;

View file

@ -0,0 +1,18 @@
#!/bin/sh
set -exo pipefail
function main() {
{
apk -U upgrade
apk add --no-cache build-base rust python3 python3-dev py3-pip py3-setuptools py3-wheel libffi-dev openssl-dev cargo bash git curl
python3 -m pip install -U pip
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection \
coverage flake8 flake8-polyfill mypy mypy-extensions pycodestyle pyflakes pylint pytest pytest-cov pytest-datafiles types-setuptools types-PyYAML
apk cache clean
} > /dev/null
rm -rf /tmp/*
}
main

View file

@ -1,8 +1,8 @@
function upgradeSystem() { function upgradeSystem() {
export DEBIAN_FRONTEND=noninteractive {
apt-get update > /dev/null apt-get update
apt-get -y install apt-utils > /dev/null apt-get -qqy upgrade
apt-get -qqy dist-upgrade > /dev/null } > /dev/null
} }
function cleanupDocker() { function cleanupDocker() {