From 17d09da7702ebcff3eab53362d1cf5393dd1c37b Mon Sep 17 00:00:00 2001 From: vista Date: Mon, 26 Aug 2024 15:06:19 +0200 Subject: [PATCH 01/18] Update .woodpecker/build_release.yml --- .woodpecker/build_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index 10fe4f9..010475a 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -31,6 +31,8 @@ steps: gen_tags: image: docker commands: + - git describe --tags --abbrev=0 + - git branch - ./gen-tag-list.sh $(git describe --tags --abbrev=0) php-${PHP_VERSION} - cat tags.txt -- 2.49.1 From 6f030ef1f9578c2845ebd93f691e9218cb6ce3b2 Mon Sep 17 00:00:00 2001 From: vista Date: Mon, 26 Aug 2024 15:06:55 +0200 Subject: [PATCH 02/18] Update .woodpecker/build_dev.yml --- .woodpecker/build_dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 3cb0c57..35d7773 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -14,6 +14,8 @@ steps: gen_tags: image: docker commands: + - git describe --tags --abbrev=0 + - git branch - pwd - ./gen-version-list.sh "v2.0.4" php-${PHP_VERSION} - cat tags.txt -- 2.49.1 From 557fc719e844e7844d9b67e796f2878ac61a6f17 Mon Sep 17 00:00:00 2001 From: vista Date: Mon, 26 Aug 2024 15:07:24 +0200 Subject: [PATCH 03/18] Update .woodpecker/build_dev.yml --- .woodpecker/build_dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 35d7773..575afcb 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -14,7 +14,7 @@ steps: gen_tags: image: docker commands: - - git describe --tags --abbrev=0 + - git tag - git branch - pwd - ./gen-version-list.sh "v2.0.4" php-${PHP_VERSION} -- 2.49.1 From d6d66a85d5c2287180df38aa69a1783fac028cac Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Wed, 28 Aug 2024 12:58:03 +0200 Subject: [PATCH 04/18] feat: only run first boot as root --- build/start-container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/start-container.sh b/build/start-container.sh index 38c8251..e1fa2e3 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -4,7 +4,7 @@ set -e # install extra packages and extensions on first boot -if [[ ! -f /etc/first_boot ]]; then +if [[ $(id -u) -eq 0 && ! -f /etc/first_boot ]]; then if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then # shellcheck disable=SC2086 apk add --no-cache $EXTRA_APK_PACKAGES -- 2.49.1 From a45c6d4b1df592bf4236c412d125a379aebb5561 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Wed, 28 Aug 2024 13:04:17 +0200 Subject: [PATCH 05/18] feat: add simplexml and xmlreader --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index d60ea31..ca022ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,8 @@ RUN apk add --no-cache \ php-exif \ php-xmlwriter \ php-tokenizer \ + php-simplexml \ + php-xmlreader \ composer \ npm \ && docker-php-ext-install filter pdo_mysql \ -- 2.49.1 From 2e4ae4d86176f5931774eb8af749445ce8ef371e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Wed, 28 Aug 2024 13:17:20 +0200 Subject: [PATCH 06/18] remove old build test --- .woodpecker/build_dev.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 575afcb..4c03e75 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -10,16 +10,6 @@ when: event: [ push, manual ] steps: - - gen_tags: - image: docker - commands: - - git tag - - git branch - - pwd - - ./gen-version-list.sh "v2.0.4" php-${PHP_VERSION} - - cat tags.txt - dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: -- 2.49.1 From 6ffb2b6ed988638dca902f59cea3944677b800fb Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Wed, 28 Aug 2024 13:46:01 +0200 Subject: [PATCH 07/18] fix for none root users move npm cache to /tmp --- build/start-container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/start-container.sh b/build/start-container.sh index e1fa2e3..31ccfce 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -23,7 +23,7 @@ fi if [[ "$BOOT_NPM_INSTALL" = true ]]; then echo "npm install" - npm install + npm install --cache /tmp/npm fi if [ ! -f /var/www/html/artisan ]; then -- 2.49.1 From 3483285a2e854cb36712f8ef83798916d6dfaa1d Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 29 Aug 2024 09:57:14 +0200 Subject: [PATCH 08/18] remove debug commands --- .woodpecker/build_release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index fb05e57..4a1b013 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -38,8 +38,6 @@ steps: gen_tags: image: docker commands: - - git describe --tags --abbrev=0 - - git branch - ./gen-tag-list.sh $(git describe --tags --abbrev=0) php-${PHP_VERSION} - cat tags.txt -- 2.49.1 From a6400ebb957629ea7941a689f82e81ee909c7501 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 29 Aug 2024 10:19:39 +0200 Subject: [PATCH 09/18] add latest tag for php-8 builds [SKIP CI] --- .woodpecker/build_release.yml | 6 +++--- gen-tag-list.sh | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index 4a1b013..b305ba4 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -1,9 +1,9 @@ matrix: PHP_VERSION: - - 8 - - 8.3 - - 8.2 - 8.1 + - 8.2 + - 8.3 + - 8 when: branch: diff --git a/gen-tag-list.sh b/gen-tag-list.sh index 2c79618..c49ebd6 100755 --- a/gen-tag-list.sh +++ b/gen-tag-list.sh @@ -12,14 +12,22 @@ fi version=$1 # Suffix -[[ -n $2 ]] && suffix="-$2" || suffix="" +suffix="" +if [[ -n $2 ]]; then + suffix="-$2" +fi + +touch tags.txt +if [[ "$2" = "php-8" ]]; then + echo "latest" >> tags.txt +fi # Check if the first character is "V" or "v" and remove it if [[ "${version:0:1}" == "V" || "${version:0:1}" == "v" ]]; then version="${version#?}" fi -echo "latest$suffix" > tags.txt +echo "latest$suffix" >> tags.txt echo "$version" | cut -d'.' -f1 | xargs -I {} echo "{}$suffix" >> tags.txt echo "$version" | cut -d'.' -f1,2 | xargs -I {} echo "{}$suffix" >> tags.txt echo "$version" | cut -d'.' -f1,2,3 | xargs -I {} echo "{}$suffix" >> tags.txt \ No newline at end of file -- 2.49.1 From 5d9b68323b7f59cda196bdc6a1e75628b6ae7f3e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 13:52:14 +0200 Subject: [PATCH 10/18] add a healthcheck to the image and an HEALTHCHECK_PATH env var --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index ca022ce..2367503 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ FROM php:${BASE_VERSION}-fpm-alpine # port to for the webserver ENV WEBSERVER_PORT=8080 +ENV HEALTHCHECK_PATH="" COPY start-container.sh /usr/local/bin/start-container @@ -32,6 +33,9 @@ RUN apk add --no-cache \ && docker-php-ext-install filter pdo_mysql \ && chmod +x /usr/local/bin/start-container +HEALTHCHECK --interval=5m --timeout=3s --start-period=5m --start-interval=10s \ + CMD curl -f http://localhost/${HEALTHCHECK_PATH} || exit 1 + EXPOSE ${WEBSERVER_PORT} WORKDIR /var/www/html -- 2.49.1 From 54cf43aad810b21193428e24cbaf406d1f790262 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 13:56:28 +0200 Subject: [PATCH 11/18] add comment [SKIP CI] --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2367503..a7a070c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ FROM php:${BASE_VERSION}-fpm-alpine # port to for the webserver ENV WEBSERVER_PORT=8080 + +# path without leading / (slash) ENV HEALTHCHECK_PATH="" COPY start-container.sh /usr/local/bin/start-container -- 2.49.1 From 426eb92f1adafb12cffe33d2fc051f33fb802ecf Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 14:03:23 +0200 Subject: [PATCH 12/18] add port to health check [SKIP CI] --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7a070c..53d6b08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN apk add --no-cache \ && chmod +x /usr/local/bin/start-container HEALTHCHECK --interval=5m --timeout=3s --start-period=5m --start-interval=10s \ - CMD curl -f http://localhost/${HEALTHCHECK_PATH} || exit 1 + CMD curl -f http://localhost:${WEBSERVER_PORT}/${HEALTHCHECK_PATH} || exit 1 EXPOSE ${WEBSERVER_PORT} -- 2.49.1 From da37cc3c4a95fcdbe8a7cd8db9a805c7f9aab60e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 14:03:23 +0200 Subject: [PATCH 13/18] add port to health check --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a7a070c..53d6b08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN apk add --no-cache \ && chmod +x /usr/local/bin/start-container HEALTHCHECK --interval=5m --timeout=3s --start-period=5m --start-interval=10s \ - CMD curl -f http://localhost/${HEALTHCHECK_PATH} || exit 1 + CMD curl -f http://localhost:${WEBSERVER_PORT}/${HEALTHCHECK_PATH} || exit 1 EXPOSE ${WEBSERVER_PORT} -- 2.49.1 From e4e5dc6524cc87b88cb268ddeeea4d4ef903bf89 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 14:12:46 +0200 Subject: [PATCH 14/18] check of a laravel project before doing other things --- build/start-container.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/start-container.sh b/build/start-container.sh index 31ccfce..03257ff 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -3,6 +3,11 @@ # exit when any command fails set -e +if [ ! -f /var/www/html/artisan ]; then + echo "No existing Laravel project found" + exit +fi + # install extra packages and extensions on first boot if [[ $(id -u) -eq 0 && ! -f /etc/first_boot ]]; then if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then @@ -26,11 +31,6 @@ if [[ "$BOOT_NPM_INSTALL" = true ]]; then npm install --cache /tmp/npm fi -if [ ! -f /var/www/html/artisan ]; then - echo "No existing Laravel project found" - exit -fi - if [[ "$BOOT_NPM_DEV" = true ]]; then echo "Staring npm dev" npm run dev --prefix /var/www/html & -- 2.49.1 From 6e956702bce5c1c9be307f2788fb8621a0075c8a Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 14:14:45 +0200 Subject: [PATCH 15/18] run option to run `artisan migrate` before staring --- build/start-container.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/start-container.sh b/build/start-container.sh index 03257ff..c2a3e74 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -31,6 +31,11 @@ if [[ "$BOOT_NPM_INSTALL" = true ]]; then npm install --cache /tmp/npm fi +if [[ "$BOOT_MIGRATE" = true ]]; then + echo "artisan migrate" + php /var/www/html/artisan migrate +fi + if [[ "$BOOT_NPM_DEV" = true ]]; then echo "Staring npm dev" npm run dev --prefix /var/www/html & -- 2.49.1 From d9d95a285e6bfa1c2d2cf71fea1cf2f462f66c8d Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 15:31:00 +0200 Subject: [PATCH 16/18] build platforms --- .woodpecker/build_dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 4c03e75..b87db0b 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -13,6 +13,7 @@ steps: dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x username: vistanarvas password: from_secret: DOCKERHUB_TOKEN -- 2.49.1 From fba60fa0e244675bdf54383cedcbbc1242627b91 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 15:50:10 +0200 Subject: [PATCH 17/18] multi arch builds --- .woodpecker/build_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index b305ba4..bec7901 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -44,6 +44,7 @@ steps: release_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x username: vistanarvas password: from_secret: DOCKERHUB_TOKEN -- 2.49.1 From 8ec450138a7b868b3321036c6d0657add4cc5f57 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 30 Aug 2024 15:50:29 +0200 Subject: [PATCH 18/18] no multi arch build for test image [SKIP CI] --- .woodpecker/build_dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index b87db0b..4c03e75 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -13,7 +13,6 @@ steps: dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x username: vistanarvas password: from_secret: DOCKERHUB_TOKEN -- 2.49.1