From 1dfeb16d03b98b086327052767cf69c72b607054 Mon Sep 17 00:00:00 2001 From: Aaron Riedel Date: Mon, 22 Jul 2024 15:15:30 +0200 Subject: [PATCH] change CI to fully build the image --- .drone.yml | 9 +++++++-- Dockerfile | 4 ---- patch-nextcloud.sh | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) delete mode 100644 Dockerfile create mode 100644 patch-nextcloud.sh diff --git a/.drone.yml b/.drone.yml index 860a450..a849970 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,6 +2,10 @@ kind: pipeline type: kubernetes name: deploy steps: +- name: patch + image: git.ar21.de/aaron/kustomize-ci + commands: + - "sh patch-nextcloud.sh" - name: docker image: thegeeklab/drone-docker-buildx privileged: true @@ -11,7 +15,7 @@ steps: from_secret: REGISTRY_USER password: from_secret: REGISTRY_PASS - repo: git.ar21.de/aaron/nextcloud-fpm + repo: git.ar21.de/aaron/nextcloud-fpm-test tags: latest platforms: - linux/arm64 @@ -41,4 +45,5 @@ steps: when: event: include: - - push \ No newline at end of file + - push + - custom \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 170c81b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM nextcloud:29.0.3-fpm -RUN apt-get update && apt-get install -y libmagickcore-6.q16-6-extra tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng ocrmypdf libbz2-dev && docker-php-ext-install bz2 && apt-get clean autoclean && apt-get autoremove -y -ADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu.traineddata /usr/share/tesseract-ocr/tessdata/ -ADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/eng.traineddata /usr/share/tesseract-ocr/tessdata/ diff --git a/patch-nextcloud.sh b/patch-nextcloud.sh new file mode 100644 index 0000000..f0d7bed --- /dev/null +++ b/patch-nextcloud.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +set -e +set -x +echo "starting patch script" +echo "clone nextcloud/docker" +git clone https://git.ar21.de/aaron/nextcloud-docker.git +echo "get latest major version" +major_version=$(find nextcloud-docker -maxdepth 1 -type d -printf "%f\n" | grep -E '^[0-9]+$' | sort -n | tail -1) +if [ -z "nextcloud-docker/$major_version" ]; then + echo "Could not determine version." + exit 1 +else + echo "Nextcloud $major_version found" +fi +echo "patch the Dockerfile" +cd "nextcloud-docker/$major_version/fpm/" +sed -i "$(awk '/^ENTRYPOINT /{line=NR} END{print line}' Dockerfile)s+^+# begin of patch\nRUN apt-get update && apt-get install -y libmagickcore-6.q16-6-extra tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng ocrmypdf libbz2-dev && docker-php-ext-install bz2 && apt-get clean autoclean && apt-get autoremove -y\nADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu.traineddata /usr/share/tesseract-ocr/tessdata/\nADD https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/eng.traineddata /usr/share/tesseract-ocr/tessdata/\n# end of patch\n+" Dockerfile +echo "determine tags" +full_version=$(grep -oP '(?<=^ENV NEXTCLOUD_VERSION ).*' Dockerfile) +echo "found $full_version" +cd ~ +echo $full_version > .tags +echo "move Dockerfile to workdir" +cp nextcloud-docker/$major_version/fpm/Dockerfile . \ No newline at end of file