diff --git a/.drone.yml b/.woodpecker.yaml similarity index 50% rename from .drone.yml rename to .woodpecker.yaml index 083f0fe..e968b48 100644 --- a/.drone.yml +++ b/.woodpecker.yaml @@ -1,13 +1,18 @@ -kind: pipeline -type: kubernetes -name: deploy +when: + - event: [push, manual] +matrix: + NEXTCLOUD_VERSION: + - 28 + - 29 steps: - name: patch image: debian - entrypoint: - - /drone/src/patch-nextcloud.sh + commands: + - "./patch-nextcloud.sh" + environment: + NEXTCLOUD_VERSION: ${NEXTCLOUD_VERSION} - name: docker - image: thegeeklab/drone-docker-buildx + image: woodpeckerci/plugin-docker-buildx privileged: true settings: registry: git.ar21.de @@ -16,14 +21,15 @@ steps: password: from_secret: REGISTRY_PASS repo: git.ar21.de/aaron/nextcloud-fpm + dockerfile: "nextcloud-docker/${NEXTCLOUD_VERSION}/fpm/Dockerfile" + tags_file: "nextcloud-docker/${NEXTCLOUD_VERSION}/fpm/.tags" platforms: - linux/arm64 - linux/amd64 when: - branch: - - main + - branch: main - name: docker-build - image: thegeeklab/drone-docker-buildx + image: woodpeckerci/plugin-docker-buildx privileged: true settings: registry: git.ar21.de @@ -32,16 +38,12 @@ steps: password: from_secret: REGISTRY_PASS repo: git.ar21.de/aaron/nextcloud-fpm + dockerfile: "nextcloud-docker/${NEXTCLOUD_VERSION}/fpm/Dockerfile" + tags_file: "nextcloud-docker/${NEXTCLOUD_VERSION}/fpm/.tags" platforms: - linux/arm64 - linux/amd64 dry_run: true when: - branch: - exclude: - - main -when: - event: - include: - - push - - custom \ No newline at end of file + - branch: + exclude: main diff --git a/patch-nextcloud.sh b/patch-nextcloud.sh index 5e51da8..1b913e5 100755 --- a/patch-nextcloud.sh +++ b/patch-nextcloud.sh @@ -1,25 +1,14 @@ #!/usr/bin/env sh set -e -echo "starting patch script" -echo "install git" -apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists -echo "clone nextcloud/docker" +echo "==> starting patch script for nextcloud $NEXTCLOUD_VERSION" +echo "==> install git" +apt-get update -q && apt-get install -q -y git && rm -rf /var/lib/apt/lists +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 "$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/" +echo "==> patch the Dockerfile" +cd "nextcloud-docker/$NEXTCLOUD_VERSION/fpm/" sed -i "$(awk '/^ENTRYPOINT /{line=NR} END{print line}' Dockerfile)s+^+# begin of patch\nRUN apt-get update\nRUN apt-get install -y libmagickcore-6.q16-6-extra tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng ocrmypdf libbz2-dev\nRUN docker-php-ext-install bz2\nRUN apt-get clean autoclean\nRUN 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" +echo "==> determine tags" full_version=$(grep -oP '(?<=^ENV NEXTCLOUD_VERSION ).*' Dockerfile) -echo "found $full_version" -cd /drone/src -echo "$full_version,latest" > .tags -echo "move Dockerfile to workdir" -cp -r nextcloud-docker/$major_version/fpm/* . \ No newline at end of file +echo "==> found $full_version" +echo "$full_version" > .tags \ No newline at end of file