From 3e760b4ed0c32c6a689f7c4f8b06327b4c21738f Mon Sep 17 00:00:00 2001 From: jem Date: Tue, 10 Aug 2021 21:29:49 +0200 Subject: [PATCH] merged lein & cljs image together to a clojure image. Added graalvm support --- .../{lein => clojure}/image/Dockerfile | 0 .../clojure/image/resources/CHECKSUMS | 2 + .../clojure/image/resources/install.sh | 37 +++++++++++++++ infrastructure/lein/build.py | 46 ------------------- infrastructure/lein/image/resources/CHECKSUMS | 1 - .../lein/image/resources/install.sh | 22 --------- infrastructure/shadow-cljs/build.py | 46 ------------------- infrastructure/shadow-cljs/image/Dockerfile | 4 -- .../shadow-cljs/image/resources/install.sh | 13 ------ 9 files changed, 39 insertions(+), 132 deletions(-) rename infrastructure/{lein => clojure}/image/Dockerfile (100%) create mode 100644 infrastructure/clojure/image/resources/CHECKSUMS create mode 100755 infrastructure/clojure/image/resources/install.sh delete mode 100644 infrastructure/lein/build.py delete mode 100644 infrastructure/lein/image/resources/CHECKSUMS delete mode 100755 infrastructure/lein/image/resources/install.sh delete mode 100644 infrastructure/shadow-cljs/build.py delete mode 100644 infrastructure/shadow-cljs/image/Dockerfile delete mode 100755 infrastructure/shadow-cljs/image/resources/install.sh diff --git a/infrastructure/lein/image/Dockerfile b/infrastructure/clojure/image/Dockerfile similarity index 100% rename from infrastructure/lein/image/Dockerfile rename to infrastructure/clojure/image/Dockerfile diff --git a/infrastructure/clojure/image/resources/CHECKSUMS b/infrastructure/clojure/image/resources/CHECKSUMS new file mode 100644 index 0000000..9f5878e --- /dev/null +++ b/infrastructure/clojure/image/resources/CHECKSUMS @@ -0,0 +1,2 @@ +d7a5cb848b783c15119316d716d8a74bf11c9e3ab050f3adf28e0678a6018467 kubeconform-v0.4.7.tar.gz +bbd3e03025168172a76c2a29e6a14c1c37e3476b30774259c3ef5952fb86f470 graalvm-ce-java11-linux-amd64-21.2.0.tar.gz diff --git a/infrastructure/clojure/image/resources/install.sh b/infrastructure/clojure/image/resources/install.sh new file mode 100755 index 0000000..9cde6ff --- /dev/null +++ b/infrastructure/clojure/image/resources/install.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -eux + +function main() { + upgradeSystem + + mkdir -p /usr/share/man/man1 + apt -qqy install openjdk-11-jre-headless leiningen curl build-essential libz-dev zlib1g-dev + + # shadow-cljs + npm install -g --save-dev shadow-cljs + + # kubeconform & graalvm + curl -Lo /tmp/kubeconform-v0.4.7.tar.gz https://github.com/yannh/kubeconform/releases/download/v0.4.7/kubeconform-linux-amd64.tar.gz + curl -Lo /tmp/graalvm-ce-java11-linux-amd64-21.2.0.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.2.0/graalvm-ce-java11-linux-amd64-21.2.0.tar.gz + + cd /tmp + sha256sum --check CHECKSUMS + + tar -xf /tmp/kubeconform-v0.4.7.tar.gz + cp kubeconform /usr/local/bin + + tar -xzf graalvm-ce-java11-linux-amd64-21.2.0.tar.gz + mv graalvm-ce-java11-21.2.0 /usr/lib/jvm/ + ln -s /usr/lib/jvm/graalvm-ce-java11-21.2.0 /usr/lib/jvm/graalvm + 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 + + gu install native-image + ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin + + cleanupDocker +} + +source /tmp/install_functions.sh +main \ No newline at end of file diff --git a/infrastructure/lein/build.py b/infrastructure/lein/build.py deleted file mode 100644 index c045ab7..0000000 --- a/infrastructure/lein/build.py +++ /dev/null @@ -1,46 +0,0 @@ -from subprocess import run -from os import environ -from pybuilder.core import task, init -from ddadevops import * -import logging - -name = 'lein' -MODULE = 'lein' -PROJECT_ROOT_PATH = '../..' - - -class MyBuild(DevopsDockerBuild): - pass - -@init -def initialize(project): - project.build_depends_on('ddadevops>=0.8.19') - stage = 'notused' - dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login') - dockerhub_password = gopass_password_from_path('meissa/web/docker.com') - config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password) - build = MyBuild(project, config) - build.initialize_build_dir() - - -@task -def image(project): - build = get_devops_build(project) - build.image() - -@task -def drun(project): - build = get_devops_build(project) - build.drun() - -@task -def test(project): - build = get_devops_build(project) - build.test() - -@task -def publish(project): - build = get_devops_build(project) - build.dockerhub_login() - build.dockerhub_publish() diff --git a/infrastructure/lein/image/resources/CHECKSUMS b/infrastructure/lein/image/resources/CHECKSUMS deleted file mode 100644 index e835b7d..0000000 --- a/infrastructure/lein/image/resources/CHECKSUMS +++ /dev/null @@ -1 +0,0 @@ -d7a5cb848b783c15119316d716d8a74bf11c9e3ab050f3adf28e0678a6018467 kubeconform.tar.gz diff --git a/infrastructure/lein/image/resources/install.sh b/infrastructure/lein/image/resources/install.sh deleted file mode 100755 index 5b95462..0000000 --- a/infrastructure/lein/image/resources/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -eux - -function main() { - upgradeSystem - - mkdir -p /usr/share/man/man1 - apt -qqy install openjdk-11-jre-headless leiningen curl - - curl -Lo /tmp/kubeconform.tar.gz https://github.com/yannh/kubeconform/releases/download/v0.4.7/kubeconform-linux-amd64.tar.gz - - cd /tmp - sha256sum --check CHECKSUMS - - tar -xf /tmp/kubeconform.tar.gz - cp kubeconform /usr/local/bin - - cleanupDocker -} - -source /tmp/install_functions.sh -main \ No newline at end of file diff --git a/infrastructure/shadow-cljs/build.py b/infrastructure/shadow-cljs/build.py deleted file mode 100644 index 6d4509b..0000000 --- a/infrastructure/shadow-cljs/build.py +++ /dev/null @@ -1,46 +0,0 @@ -from subprocess import run -from os import environ -from pybuilder.core import task, init -from ddadevops import * -import logging - -name = 'shadow-cljs' -MODULE = 'shadow-cljs' -PROJECT_ROOT_PATH = '../..' - - -class MyBuild(DevopsDockerBuild): - pass - -@init -def initialize(project): - project.build_depends_on('ddadevops>=0.8.19') - stage = 'notused' - dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login') - dockerhub_password = gopass_password_from_path('meissa/web/docker.com') - config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password) - build = MyBuild(project, config) - build.initialize_build_dir() - - -@task -def image(project): - build = get_devops_build(project) - build.image() - -@task -def drun(project): - build = get_devops_build(project) - build.drun() - -@task -def test(project): - build = get_devops_build(project) - build.test() - -@task -def publish(project): - build = get_devops_build(project) - build.dockerhub_login() - build.dockerhub_publish() diff --git a/infrastructure/shadow-cljs/image/Dockerfile b/infrastructure/shadow-cljs/image/Dockerfile deleted file mode 100644 index 8aa0d0d..0000000 --- a/infrastructure/shadow-cljs/image/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM node:lts-buster-slim - -ADD resources /tmp -RUN /tmp/install.sh \ No newline at end of file diff --git a/infrastructure/shadow-cljs/image/resources/install.sh b/infrastructure/shadow-cljs/image/resources/install.sh deleted file mode 100755 index 515c3db..0000000 --- a/infrastructure/shadow-cljs/image/resources/install.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -eux - -function main() { - mkdir -p /usr/share/man/man1 - apt update && apt -qqy install openjdk-11-jre-headless - npm install -g --save-dev shadow-cljs - - cleanupDocker -} - -source /tmp/install_functions.sh -main \ No newline at end of file