From 50fe9775d9701997c91a9ec3b62d1d31fc3f1d50 Mon Sep 17 00:00:00 2001 From: Mirco Date: Thu, 21 Dec 2023 22:21:33 +0100 Subject: [PATCH] Improvements docker image building --- .gitlab-ci.yml | 6 ++--- infrastructure/backup/image/Dockerfile | 2 +- .../backup/image/resources/backup.sh | 2 +- .../resources/entrypoint-start-and-wait.sh | 2 ++ .../backup/image/resources/entrypoint.sh | 2 ++ infrastructure/backup/image/resources/init.sh | 2 ++ .../backup/image/resources/install.sh | 24 +++++++++++++------ .../image/resources/restic-snapshots.sh | 2 +- .../backup/image/resources/restore.sh | 2 +- infrastructure/backup/test/Dockerfile | 11 --------- infrastructure/federated/image/Dockerfile | 6 +++-- infrastructure/federated/test/Dockerfile | 10 -------- project.clj | 6 ++--- 13 files changed, 37 insertions(+), 40 deletions(-) delete mode 100644 infrastructure/backup/test/Dockerfile delete mode 100644 infrastructure/federated/test/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 832d12d..b70acc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: - image .img: &img - image: "domaindrivenarchitecture/ddadevops-dind:4.7.4" + image: "domaindrivenarchitecture/ddadevops-dind:4.10.5" services: - docker:dind before_script: @@ -16,7 +16,7 @@ stages: - export IMAGE_TAG=$CI_COMMIT_TAG .cljs-job: &cljs - image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.7.4" + image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.10.5" cache: key: ${CI_COMMIT_REF_SLUG} paths: @@ -29,7 +29,7 @@ stages: - npm install .clj-job: &clj - image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.7.4" + image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.10.5" cache: key: ${CI_COMMIT_REF_SLUG} paths: diff --git a/infrastructure/backup/image/Dockerfile b/infrastructure/backup/image/Dockerfile index 87f0f16..e6e11b4 100644 --- a/infrastructure/backup/image/Dockerfile +++ b/infrastructure/backup/image/Dockerfile @@ -1,4 +1,4 @@ -FROM domaindrivenarchitecture/dda-backup:1.0.9 +FROM domaindrivenarchitecture/dda-backup:latest # Prepare Entrypoint Script ADD resources /tmp diff --git a/infrastructure/backup/image/resources/backup.sh b/infrastructure/backup/image/resources/backup.sh index d2549fd..191ca81 100755 --- a/infrastructure/backup/image/resources/backup.sh +++ b/infrastructure/backup/image/resources/backup.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -o pipefail +set -Eexo pipefail function main() { file_env AWS_ACCESS_KEY_ID diff --git a/infrastructure/backup/image/resources/entrypoint-start-and-wait.sh b/infrastructure/backup/image/resources/entrypoint-start-and-wait.sh index c6addac..7f6cb71 100644 --- a/infrastructure/backup/image/resources/entrypoint-start-and-wait.sh +++ b/infrastructure/backup/image/resources/entrypoint-start-and-wait.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -Eexo pipefail + function main() { create-pg-pass diff --git a/infrastructure/backup/image/resources/entrypoint.sh b/infrastructure/backup/image/resources/entrypoint.sh index 96df4f3..06df61a 100755 --- a/infrastructure/backup/image/resources/entrypoint.sh +++ b/infrastructure/backup/image/resources/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -Eexo pipefail + function main() { create-pg-pass diff --git a/infrastructure/backup/image/resources/init.sh b/infrastructure/backup/image/resources/init.sh index 1f47fa5..00816fc 100755 --- a/infrastructure/backup/image/resources/init.sh +++ b/infrastructure/backup/image/resources/init.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -Eexo pipefail + function main() { file_env AWS_ACCESS_KEY_ID file_env AWS_SECRET_ACCESS_KEY diff --git a/infrastructure/backup/image/resources/install.sh b/infrastructure/backup/image/resources/install.sh index 1a8cbd7..666cec1 100755 --- a/infrastructure/backup/image/resources/install.sh +++ b/infrastructure/backup/image/resources/install.sh @@ -1,11 +1,21 @@ #!/bin/bash -apt-get update > /dev/null; +set -exo pipefail -install -m 0700 /tmp/entrypoint.sh / -install -m 0700 /tmp/entrypoint-start-and-wait.sh / +function main() +{ + upgradeSystem + + install -m 0700 /tmp/entrypoint.sh / + install -m 0700 /tmp/entrypoint-start-and-wait.sh / -install -m 0700 /tmp/init.sh /usr/local/bin/ -install -m 0700 /tmp/backup.sh /usr/local/bin/ -install -m 0700 /tmp/restore.sh /usr/local/bin/ -install -m 0700 /tmp/restic-snapshots.sh /usr/local/bin/ + install -m 0700 /tmp/init.sh /usr/local/bin/ + install -m 0700 /tmp/backup.sh /usr/local/bin/ + install -m 0700 /tmp/restore.sh /usr/local/bin/ + install -m 0700 /tmp/restic-snapshots.sh /usr/local/bin/ + + cleanupDocker +} > /dev/null + +source /tmp/install_functions_debian.sh +DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main \ No newline at end of file diff --git a/infrastructure/backup/image/resources/restic-snapshots.sh b/infrastructure/backup/image/resources/restic-snapshots.sh index 1d97a2c..1330610 100755 --- a/infrastructure/backup/image/resources/restic-snapshots.sh +++ b/infrastructure/backup/image/resources/restic-snapshots.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -o pipefail +set -exo pipefail function main() { file_env AWS_ACCESS_KEY_ID diff --git a/infrastructure/backup/image/resources/restore.sh b/infrastructure/backup/image/resources/restore.sh index 6ed2fc0..1c16790 100755 --- a/infrastructure/backup/image/resources/restore.sh +++ b/infrastructure/backup/image/resources/restore.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -Eeo pipefail +set -Eexo pipefail function main() { diff --git a/infrastructure/backup/test/Dockerfile b/infrastructure/backup/test/Dockerfile deleted file mode 100644 index 0db1c6c..0000000 --- a/infrastructure/backup/test/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM c4k-forgejo-backup - -RUN apt update -RUN apt -yqq --no-install-recommends --yes install curl default-jre-headless - -RUN curl -L -o /tmp/serverspec.jar \ - https://github.com/DomainDrivenArchitecture/dda-serverspec-crate/releases/download/2.0.0/dda-serverspec-standalone.jar - -COPY serverspec.edn /tmp/serverspec.edn - -RUN java -jar /tmp/serverspec.jar /tmp/serverspec.edn -v \ No newline at end of file diff --git a/infrastructure/federated/image/Dockerfile b/infrastructure/federated/image/Dockerfile index 4a82745..692c9cb 100644 --- a/infrastructure/federated/image/Dockerfile +++ b/infrastructure/federated/image/Dockerfile @@ -9,12 +9,14 @@ ARG TAGS="sqlite sqlite_unlock_notify" ENV TAGS "bindata timetzdata $TAGS" ARG CGO_EXTRA_CFLAGS -ENV FORGEJO_GIT_URL "https://codeberg.org/forgejo/forgejo.git" +ENV FORGEJO_GIT_URL "https://codeberg.org/meissa/forgejo.git" #ENV FORGEJO_GIT_URL "https://git.exozy.me/a/gitea.git" -ENV FORGEJO_BRANCH "forgejo-development" +ENV FORGEJO_BRANCH "forgejo-federated-star" #ENV FORGEJO_BRANCH "libreplanet-federation-demo" #Build deps +RUN apk -U upgrade +RUN apk cache clean RUN apk --no-cache add build-base git nodejs npm #Setup repo diff --git a/infrastructure/federated/test/Dockerfile b/infrastructure/federated/test/Dockerfile deleted file mode 100644 index 047e2b9..0000000 --- a/infrastructure/federated/test/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM c4k-forgejo-federated - -RUN apk --no-cache add openjdk11-jre-headless - -RUN curl -L -o /tmp/serverspec.jar \ - https://github.com/DomainDrivenArchitecture/dda-serverspec-crate/releases/download/2.0.0/dda-serverspec-standalone.jar - -COPY serverspec.edn /tmp/serverspec.edn - -RUN java -jar /tmp/serverspec.jar /tmp/serverspec.edn -v diff --git a/project.clj b/project.clj index 7aa19ee..10c9072 100644 --- a/project.clj +++ b/project.clj @@ -4,8 +4,8 @@ :license {:name "Apache License, Version 2.0" :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.11.1" :scope "provided"] - [org.clojure/tools.reader "1.3.6"] - [org.domaindrivenarchitecture/c4k-common-clj "6.0.3"] + [org.clojure/tools.reader "1.3.7"] + [org.domaindrivenarchitecture/c4k-common-clj "6.1.0"] [hickory "0.7.1"]] :target-path "target/%s/" :source-paths ["src/main/cljc" @@ -23,7 +23,7 @@ :main dda.c4k-forgejo.uberjar :uberjar-name "c4k-forgejo-standalone.jar" :dependencies [[org.clojure/tools.cli "1.0.219"] - [ch.qos.logback/logback-classic "1.4.11" + [ch.qos.logback/logback-classic "1.4.14" :exclusions [com.sun.mail/javax.mail]] [org.slf4j/jcl-over-slf4j "2.0.9"]]}} :release-tasks [["test"]