From 40ad6255562d06bbb135c4ff0f16a0e32f8a2707 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:10:49 +0200 Subject: [PATCH 01/63] combine all run commands --- Dockerfile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 032079c..10e3882 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,20 +16,20 @@ ENV NVM_DIR="/home/$USERNAME/.nvm" COPY start-container.sh /usr/local/bin/start-container -RUN apt-get -y update -RUN apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd -RUN apt-get clean -RUN useradd --create-home --uid=${USER_UID} ${USERNAME} -RUN chmod +x /usr/local/bin/start-container -RUN echo "install composer" -RUN curl -o composer-setup.php https://getcomposer.org/installer -RUN curl -o composer-setup.sig https://composer.github.io/installer.sig -RUN echo " composer-setup.php" >> composer-setup.sig -RUN sha384sum -c composer-setup.sig -RUN if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi -RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION -RUN rm composer-setup.php composer-setup.sig /var/www/html/* -RUN chown $USERNAME:$USERNAME /var/www/html +RUN apt-get -y update; \ + apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd; \ + apt-get clean; \ + useradd --create-home --uid=${USER_UID} ${USERNAME}; \ + chmod +x /usr/local/bin/start-container; \ + echo "install composer"; \ + curl -o composer-setup.php https://getcomposer.org/installer; \ + curl -o composer-setup.sig https://composer.github.io/installer.sig; \ + echo " composer-setup.php" >> composer-setup.sig; \ + sha384sum -c composer-setup.sig; \ + if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi; \ + php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION; \ + rm composer-setup.php composer-setup.sig /var/www/html/*; \ + chown $USERNAME:$USERNAME /var/www/html; \ EXPOSE 8080 -- 2.49.1 From 0e95ac4a5551b52e6e78f8f88f74b576bf85d99e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:12:58 +0200 Subject: [PATCH 02/63] allow to run on all branches --- .woodpecker/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 3e89361..4b2801b 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -1,6 +1,3 @@ -when: - branch: master - steps: release_build_and_publish: image: woodpeckerci/plugin-docker-buildx @@ -12,6 +9,8 @@ steps: repo: vistanarvas/${CI_REPO_NAME} auto_tag: true when: + branch: + include: [ main, master ] event: release cron_build_and_publish: @@ -24,6 +23,8 @@ steps: repo: vistanarvas/${CI_REPO_NAME} tag: nightly when: + branch: + include: [ main, master ] path: include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile' ] cron: nightly -- 2.49.1 From 42ea0720f5aa68dd2e79c2aff3d0e91df28f3f96 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:18:42 +0200 Subject: [PATCH 03/63] split INSTALL_BEFORE_START into BOOT_NPM_INSTALL and BOOT_COMPOSER_INSTALL --- .env.example | 10 ++++++++-- build/start-container.sh | 13 ++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 8b1213a..cf1f8b3 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,14 @@ # the laravel version to install (empty for latest) LARAVEL_VERSION= -# weather to run "npm dev run" at boot -AUTO_START_NPM_DEV=true +# weather to run "npm dev" at boot +BOOT_NPM_DEV=true + +# runs npm install at boot +BOOT_NPM_INSTALL=true + +# runs composer install at boot +BOOT_COMPOSER_INSTALL=true # external ports FORWARD_LARAVEL_PORT=80 diff --git a/build/start-container.sh b/build/start-container.sh index 5b2a357..5ccf337 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -6,19 +6,22 @@ set -e # init nvm \. $NVM_DIR/nvm.sh - -if [[ "$INSTALL_BEFORE_START" = true ]]; then - echo "composer and npm install" - composer install +if [[ "$BOOT_NPM_INSTALL" = true ]]; then + echo "npm install" npm install fi +if [[ "$BOOT_COMPOSER_INSTALL" = true ]]; then + echo "composer install" + composer install +fi + if [ ! -f /var/www/html/artisan ]; then echo "No existing Laravel project found" exit fi -if [[ "$AUTO_START_NPM_DEV" = true ]]; then +if [[ "$BOOT_NPM_DEV" = true ]]; then echo "Staring npm dev" npm run dev --prefix /var/www/html & fi -- 2.49.1 From 7f3fb0a9c956f3bfb4dfb0d5363a9e9b72498f64 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:20:05 +0200 Subject: [PATCH 04/63] fix run command extra training \ --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 10e3882..7a16897 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN apt-get -y update; \ if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi; \ php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION; \ rm composer-setup.php composer-setup.sig /var/www/html/*; \ - chown $USERNAME:$USERNAME /var/www/html; \ + chown $USERNAME:$USERNAME /var/www/html; EXPOSE 8080 -- 2.49.1 From 4dd28bee01a80fb7ad136c4e3cc62af2b1a353c9 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:50:30 +0200 Subject: [PATCH 05/63] run as root --- Dockerfile | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a16897..8c9c6ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ FROM ubuntu:latest -ARG USERNAME=laravel -ARG USER_UID=1080 - # node version number like "12.22.1" or empty for the latest version ARG NODE_VERSION='' @@ -12,37 +9,33 @@ ARG COMPOSER_VERSION='' # disables asking for input ARG DEBIAN_FRONTEND="noninteractive" -ENV NVM_DIR="/home/$USERNAME/.nvm" +ENV NVM_DIR="~/.nvm" COPY start-container.sh /usr/local/bin/start-container RUN apt-get -y update; \ - apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd; \ - apt-get clean; \ - useradd --create-home --uid=${USER_UID} ${USERNAME}; \ - chmod +x /usr/local/bin/start-container; \ - echo "install composer"; \ - curl -o composer-setup.php https://getcomposer.org/installer; \ - curl -o composer-setup.sig https://composer.github.io/installer.sig; \ - echo " composer-setup.php" >> composer-setup.sig; \ - sha384sum -c composer-setup.sig; \ - if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi; \ - php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION; \ - rm composer-setup.php composer-setup.sig /var/www/html/*; \ - chown $USERNAME:$USERNAME /var/www/html; + && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd; \ + && apt-get clean; \ + && chmod +x /usr/local/bin/start-container; \ + && echo "install composer"; \ + && curl -o composer-setup.php https://getcomposer.org/installer; \ + && curl -o composer-setup.sig https://composer.github.io/installer.sig; \ + && echo " composer-setup.php" >> composer-setup.sig; \ + && sha384sum -c composer-setup.sig; \ + && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi; \ + && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION; \ + && rm composer-setup.php composer-setup.sig /var/www/html/*; \ + && chown $USERNAME:$USERNAME /var/www/html; \ + && echo "install nvm and node"; \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash; \ + && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi; \ + && echo "source $NVM_DIR/nvm.sh" >> ~/.bashrc; \ + && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"; \ + && nvm install $NODE_VERSION; \ + && nvm alias default $NODE_VERSION; EXPOSE 8080 WORKDIR /var/www/html -USER $USERNAME - -RUN echo "install nvm and node" \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ - && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ - && echo "source $NVM_DIR/nvm.sh" >> /home/$USERNAME/.bashrc \ - && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION - ENTRYPOINT ["start-container"] \ No newline at end of file -- 2.49.1 From 7d42d92f129676cb38732f64432c4354e2a5de44 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:51:53 +0200 Subject: [PATCH 06/63] run as root --- Dockerfile | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c9c6ad..66e9894 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,24 +14,24 @@ ENV NVM_DIR="~/.nvm" COPY start-container.sh /usr/local/bin/start-container RUN apt-get -y update; \ - && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd; \ - && apt-get clean; \ - && chmod +x /usr/local/bin/start-container; \ - && echo "install composer"; \ - && curl -o composer-setup.php https://getcomposer.org/installer; \ - && curl -o composer-setup.sig https://composer.github.io/installer.sig; \ - && echo " composer-setup.php" >> composer-setup.sig; \ - && sha384sum -c composer-setup.sig; \ - && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi; \ - && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION; \ - && rm composer-setup.php composer-setup.sig /var/www/html/*; \ - && chown $USERNAME:$USERNAME /var/www/html; \ - && echo "install nvm and node"; \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash; \ - && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi; \ - && echo "source $NVM_DIR/nvm.sh" >> ~/.bashrc; \ - && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"; \ - && nvm install $NODE_VERSION; \ + && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd \ + && apt-get clean \ + && chmod +x /usr/local/bin/start-container \ + && echo "install composer" \ + && curl -o composer-setup.php https://getcomposer.org/installer \ + && curl -o composer-setup.sig https://composer.github.io/installer.sig \ + && echo " composer-setup.php" >> composer-setup.sig \ + && sha384sum -c composer-setup.sig \ + && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ + && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ + && rm composer-setup.php composer-setup.sig /var/www/html/* \ + && chown $USERNAME:$USERNAME /var/www/html \ + && echo "install nvm and node" \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ + && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ + && echo "source $NVM_DIR/nvm.sh" >> ~/.bashrc \ + && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ + && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION; EXPOSE 8080 -- 2.49.1 From bfe7b285bd175ebc4d86c52f0b67f4aefd5b6e36 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 15:53:07 +0200 Subject: [PATCH 07/63] run as root --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 66e9894..0da2765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ ENV NVM_DIR="~/.nvm" COPY start-container.sh /usr/local/bin/start-container -RUN apt-get -y update; \ +RUN apt-get -y update \ && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd \ && apt-get clean \ && chmod +x /usr/local/bin/start-container \ -- 2.49.1 From e0b39f56f03a9081e0897fdd3f9e38ee4642e883 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 16:01:32 +0200 Subject: [PATCH 08/63] run as root --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0da2765..52db6a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,11 @@ ARG COMPOSER_VERSION='' # disables asking for input ARG DEBIAN_FRONTEND="noninteractive" -ENV NVM_DIR="~/.nvm" +ENV NVM_DIR="/root/.nvm" COPY start-container.sh /usr/local/bin/start-container +RUN echo ${XDG_CONFIG_HOME} RUN apt-get -y update \ && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd \ && apt-get clean \ @@ -29,7 +30,6 @@ RUN apt-get -y update \ && echo "install nvm and node" \ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ - && echo "source $NVM_DIR/nvm.sh" >> ~/.bashrc \ && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION; -- 2.49.1 From 9b0bf676a0ad819d68e0fa38374a3d15f38c271b Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 16:16:12 +0200 Subject: [PATCH 09/63] install more php pkgs --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 52db6a6..947bf20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,8 @@ ENV NVM_DIR="/root/.nvm" COPY start-container.sh /usr/local/bin/start-container -RUN echo ${XDG_CONFIG_HOME} RUN apt-get -y update \ - && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd \ + && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd php-zip php-bcmath php-intl \ && apt-get clean \ && chmod +x /usr/local/bin/start-container \ && echo "install composer" \ -- 2.49.1 From 9c8504a723c1a114b89fc6fdd4ba1a62985ea577 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 16:29:08 +0200 Subject: [PATCH 10/63] change host to 0.0.0.0 to accept all connections [SKIP CI] --- 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 5ccf337..5b9f420 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -27,4 +27,4 @@ if [[ "$BOOT_NPM_DEV" = true ]]; then fi echo "Staring Laravel" -php /var/www/html/artisan serve +php /var/www/html/artisan serve --host=0.0.0.0 -- 2.49.1 From b4c00d4459d65fa2222e0d4251534190169ef53d Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Tue, 20 Aug 2024 17:04:17 +0200 Subject: [PATCH 11/63] option to change the port of the webserver --- Dockerfile | 5 ++++- build/start-container.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 947bf20..25e1d9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,9 @@ ARG DEBIAN_FRONTEND="noninteractive" ENV NVM_DIR="/root/.nvm" +# port to for the webserver +ENV WEBSERVER_PORT=8080 + COPY start-container.sh /usr/local/bin/start-container RUN apt-get -y update \ @@ -33,7 +36,7 @@ RUN apt-get -y update \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION; -EXPOSE 8080 +EXPOSE ${WEBSERVER_PORT} WORKDIR /var/www/html diff --git a/build/start-container.sh b/build/start-container.sh index 5b9f420..ce773fb 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -4,7 +4,7 @@ set -e # init nvm -\. $NVM_DIR/nvm.sh +\. "$NVM_DIR"/nvm.sh if [[ "$BOOT_NPM_INSTALL" = true ]]; then echo "npm install" @@ -27,4 +27,4 @@ if [[ "$BOOT_NPM_DEV" = true ]]; then fi echo "Staring Laravel" -php /var/www/html/artisan serve --host=0.0.0.0 +php /var/www/html/artisan serve --host=0.0.0.0 --port="$WEBSERVER_PORT" -- 2.49.1 From d3b38ddf776a5f387b83a61709d9555d14f54f50 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 09:50:07 +0200 Subject: [PATCH 12/63] simplify composer example --- .env.example | 25 ------------------------- docker-compose.yml | 31 ++++++++++++++++--------------- 2 files changed, 16 insertions(+), 40 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index cf1f8b3..0000000 --- a/.env.example +++ /dev/null @@ -1,25 +0,0 @@ -# the laravel version to install (empty for latest) -LARAVEL_VERSION= - -# weather to run "npm dev" at boot -BOOT_NPM_DEV=true - -# runs npm install at boot -BOOT_NPM_INSTALL=true - -# runs composer install at boot -BOOT_COMPOSER_INSTALL=true - -# external ports -FORWARD_LARAVEL_PORT=80 -FORWARD_VITE_PORT=5173 -FORWARD_DB_PORT=3306 -FORWARD_REDIS_PORT=6379 -FORWARD_MAILPIT_PORT=1025 -FORWARD_MAILPIT_DASHBOARD_PORT=8025 - -# DB settings (this will overwrite the defaults in the laravel project) -DB_PORT=3306 -DB_DATABASE=laravel -DB_USERNAME=laravel -DB_PASSWORD=password diff --git a/docker-compose.yml b/docker-compose.yml index d610b78..ce008c0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,21 @@ version: '3' services: app: - build: - context: build - dockerfile: Dockerfile - image: laravel + image: vistanarvas/simple-laravel ports: - - '${FORWARD_LARAVEL_PORT:-80}:8080' - - '${FORWARD_VITE_PORT:-5173}:5173' + - '8080:80' + - '5173:5173' environment: - LARAVEL_VERSION: '${LARAVEL_VERSION}' - AUTO_START_NPM_DEV: '${AUTO_START_NPM_DEV:-false}' - DB_HOST: mysql + WEBSERVER_PORT: 80 DB_CONNECTION: mysql - env_file: - .env + DB_HOST: mysql + DB_PORT: 3306 + DB_DATABASE: laravel + DB_USERNAME: laravel + DB_PASSWORD: password + BOOT_NPM_DEV: true # also starts `npm dev` + BOOT_NPM_INSTALL: true # runs `npm install` on boot + BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot depends_on: - mysql - redis @@ -23,7 +24,7 @@ services: mysql: image: 'mysql/mysql-server:8.0' ports: - - '${FORWARD_DB_PORT:-3306}:3306' + - '3306:3306' environment: MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' MYSQL_ROOT_HOST: '%' @@ -37,15 +38,15 @@ services: redis: image: 'redis:alpine' ports: - - '${FORWARD_REDIS_PORT:-6379}:6379' + - '6379:6379' volumes: - 'redis:/data' mailpit: image: 'axllent/mailpit:latest' ports: - - '${FORWARD_MAILPIT_PORT:-1025}:1025' - - '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025' + - '1025:1025' + - '8025:8025' volumes: mysql: -- 2.49.1 From 6cb56669919f272652c07a66f3517bd9ca732aba Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:19:09 +0200 Subject: [PATCH 13/63] add alpine build --- .woodpecker/build.yml | 35 ++++++++++++++++++++++++------ Dockerfile_alpine | 38 +++++++++++++++++++++++++++++++++ Dockerfile => Dockerfile_ubuntu | 0 3 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 Dockerfile_alpine rename Dockerfile => Dockerfile_ubuntu (100%) diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml index 4b2801b..efae57c 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build.yml @@ -1,5 +1,5 @@ steps: - release_build_and_publish: + release_ubuntu_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: username: vistanarvas @@ -8,12 +8,14 @@ steps: context: ./build repo: vistanarvas/${CI_REPO_NAME} auto_tag: true + default_suffix: -ubuntu + dockerfile: Dockerfile_alpine when: branch: include: [ main, master ] event: release - cron_build_and_publish: + cron_ubuntu_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: username: vistanarvas @@ -21,16 +23,17 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: nightly + tag: nightly-ubuntu + dockerfile: Dockerfile_alpine when: branch: include: [ main, master ] path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile' ] + include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_ubuntu' ] cron: nightly event: [ cron ] - dev_build_and_publish: + dev_ubuntu_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: username: vistanarvas @@ -38,10 +41,28 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH} + tag: ${CI_COMMIT_BRANCH}-ubuntu + dockerfile: Dockerfile_alpine when: branch: exclude: [ main, master ] path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile' ] + include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_ubuntu' ] + event: [ push, manual ] + + dev_alpine_build_and_publish: + image: woodpeckerci/plugin-docker-buildx + settings: + username: vistanarvas + password: + from_secret: DOCKERHUB_TOKEN + context: ./build + repo: vistanarvas/${CI_REPO_NAME} + tag: ${CI_COMMIT_BRANCH}-alpine + dockerfile: Dockerfile_alpine + when: + branch: + exclude: [ main, master ] + path: + include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_alpine' ] event: [ push, manual ] \ No newline at end of file diff --git a/Dockerfile_alpine b/Dockerfile_alpine new file mode 100644 index 0000000..a99d0e9 --- /dev/null +++ b/Dockerfile_alpine @@ -0,0 +1,38 @@ +FROM php:8-fpm-alpine + +# node version number like "12.22.1" or empty for the latest version +ARG NODE_VERSION='' + +# composer version number like "2.1" or empty for the latest version +ARG COMPOSER_VERSION='' + +ENV NVM_DIR="/root/.nvm" + +# port to for the webserver +ENV WEBSERVER_PORT=8080 + +COPY start-container.sh /usr/local/bin/start-container + +RUN docker-php-ext-install ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml \ + && chmod +x /usr/local/bin/start-container \ + && echo "install composer" \ + && curl -o composer-setup.php https://getcomposer.org/installer \ + && curl -o composer-setup.sig https://composer.github.io/installer.sig \ + && echo " composer-setup.php" >> composer-setup.sig \ + && sha384sum -c composer-setup.sig \ + && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ + && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ + && rm composer-setup.php composer-setup.sig /var/www/html/* \ + && chown $USERNAME:$USERNAME /var/www/html \ + && echo "install nvm and node" \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ + && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ + && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION; + +EXPOSE ${WEBSERVER_PORT} + +WORKDIR /var/www/html + +ENTRYPOINT ["start-container"] \ No newline at end of file diff --git a/Dockerfile b/Dockerfile_ubuntu similarity index 100% rename from Dockerfile rename to Dockerfile_ubuntu -- 2.49.1 From bba54414211bbef13664112bf9c3b0d565ac22eb Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:25:33 +0200 Subject: [PATCH 14/63] separate steps for alpine and ubuntu --- .woodpecker/build_alpine.yml | 17 +++++++++++++++ .woodpecker/{build.yml => build_ubuntu.yml} | 23 +++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 .woodpecker/build_alpine.yml rename .woodpecker/{build.yml => build_ubuntu.yml} (68%) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml new file mode 100644 index 0000000..d4230c0 --- /dev/null +++ b/.woodpecker/build_alpine.yml @@ -0,0 +1,17 @@ +steps: + dev_alpine_build_and_publish: + image: woodpeckerci/plugin-docker-buildx + settings: + username: vistanarvas + password: + from_secret: DOCKERHUB_TOKEN + context: ./build + repo: vistanarvas/${CI_REPO_NAME} + tag: ${CI_COMMIT_BRANCH}-alpine + dockerfile: Dockerfile_alpine + when: + branch: + exclude: [ main, master ] + path: + include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_alpine' ] + event: [ push, manual ] \ No newline at end of file diff --git a/.woodpecker/build.yml b/.woodpecker/build_ubuntu.yml similarity index 68% rename from .woodpecker/build.yml rename to .woodpecker/build_ubuntu.yml index efae57c..6095809 100644 --- a/.woodpecker/build.yml +++ b/.woodpecker/build_ubuntu.yml @@ -9,7 +9,7 @@ steps: repo: vistanarvas/${CI_REPO_NAME} auto_tag: true default_suffix: -ubuntu - dockerfile: Dockerfile_alpine + dockerfile: Dockerfile_ubuntu when: branch: include: [ main, master ] @@ -24,7 +24,7 @@ steps: context: ./build repo: vistanarvas/${CI_REPO_NAME} tag: nightly-ubuntu - dockerfile: Dockerfile_alpine + dockerfile: Dockerfile_ubuntu when: branch: include: [ main, master ] @@ -42,27 +42,10 @@ steps: context: ./build repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-ubuntu - dockerfile: Dockerfile_alpine + dockerfile: Dockerfile_ubuntu when: branch: exclude: [ main, master ] path: include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_ubuntu' ] - event: [ push, manual ] - - dev_alpine_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: - from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-alpine - dockerfile: Dockerfile_alpine - when: - branch: - exclude: [ main, master ] - path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_alpine' ] event: [ push, manual ] \ No newline at end of file -- 2.49.1 From c24604d052beddfc12e2fa108f5452bf063ba34f Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:26:03 +0200 Subject: [PATCH 15/63] separate steps for alpine and ubuntu --- .woodpecker/build_alpine.yml | 2 +- .woodpecker/build_ubuntu.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index d4230c0..ab9f422 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -13,5 +13,5 @@ steps: branch: exclude: [ main, master ] path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_alpine' ] + include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] event: [ push, manual ] \ No newline at end of file diff --git a/.woodpecker/build_ubuntu.yml b/.woodpecker/build_ubuntu.yml index 6095809..1370cda 100644 --- a/.woodpecker/build_ubuntu.yml +++ b/.woodpecker/build_ubuntu.yml @@ -29,7 +29,7 @@ steps: branch: include: [ main, master ] path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_ubuntu' ] + include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] cron: nightly event: [ cron ] @@ -47,5 +47,5 @@ steps: branch: exclude: [ main, master ] path: - include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile_ubuntu' ] + include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] event: [ push, manual ] \ No newline at end of file -- 2.49.1 From 02d97d75aad9e54676f2606aeb186bc443356d51 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:28:10 +0200 Subject: [PATCH 16/63] add curl pkg --- Dockerfile_alpine | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile_alpine b/Dockerfile_alpine index a99d0e9..74df4c7 100644 --- a/Dockerfile_alpine +++ b/Dockerfile_alpine @@ -13,7 +13,8 @@ ENV WEBSERVER_PORT=8080 COPY start-container.sh /usr/local/bin/start-container -RUN docker-php-ext-install ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml \ +RUN apk add --no-cache curl \ + && docker-php-ext-install ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml \ && chmod +x /usr/local/bin/start-container \ && echo "install composer" \ && curl -o composer-setup.php https://getcomposer.org/installer \ -- 2.49.1 From 092de40f5a39dfefe9df044bc0c53d332f377cc4 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:35:55 +0200 Subject: [PATCH 17/63] add libcurl pkg --- Dockerfile_alpine | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile_alpine b/Dockerfile_alpine index 74df4c7..4600f09 100644 --- a/Dockerfile_alpine +++ b/Dockerfile_alpine @@ -13,7 +13,7 @@ ENV WEBSERVER_PORT=8080 COPY start-container.sh /usr/local/bin/start-container -RUN apk add --no-cache curl \ +RUN apk add --no-cache libcurl \ && docker-php-ext-install ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml \ && chmod +x /usr/local/bin/start-container \ && echo "install composer" \ @@ -24,7 +24,6 @@ RUN apk add --no-cache curl \ && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ && rm composer-setup.php composer-setup.sig /var/www/html/* \ - && chown $USERNAME:$USERNAME /var/www/html \ && echo "install nvm and node" \ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ -- 2.49.1 From efef61255afb1b078516feb59e331888420f7bed Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:38:41 +0200 Subject: [PATCH 18/63] skip empty pipelines [SKIP CI] --- .woodpecker/build_alpine.yml | 8 ++++++++ .woodpecker/build_ubuntu.yml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index ab9f422..1cc7e6d 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -1,3 +1,11 @@ +when: + branch: + include: [ main, master ] + path: + include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] + cron: nightly + event: [ cron, release, push, manual ] + steps: dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx diff --git a/.woodpecker/build_ubuntu.yml b/.woodpecker/build_ubuntu.yml index 1370cda..6246351 100644 --- a/.woodpecker/build_ubuntu.yml +++ b/.woodpecker/build_ubuntu.yml @@ -1,3 +1,11 @@ +when: + branch: + include: [ main, master ] + path: + include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] + cron: nightly + event: [ cron, release, push, manual ] + steps: release_ubuntu_build_and_publish: image: woodpeckerci/plugin-docker-buildx -- 2.49.1 From 2739f1040e04659f77d20dd099696cd807fa0392 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 11:39:11 +0200 Subject: [PATCH 19/63] dont chown /var/www/html [SKIP CI] --- Dockerfile_ubuntu | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile_ubuntu b/Dockerfile_ubuntu index 25e1d9f..ba24d90 100644 --- a/Dockerfile_ubuntu +++ b/Dockerfile_ubuntu @@ -28,7 +28,6 @@ RUN apt-get -y update \ && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ && rm composer-setup.php composer-setup.sig /var/www/html/* \ - && chown $USERNAME:$USERNAME /var/www/html \ && echo "install nvm and node" \ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ -- 2.49.1 From df912b1bb308b8ccf04ef889c5ee332629e49f3e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 12:01:26 +0200 Subject: [PATCH 20/63] install required packages and skip preinstalled php extensions --- Dockerfile_alpine | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile_alpine b/Dockerfile_alpine index 4600f09..a61a717 100644 --- a/Dockerfile_alpine +++ b/Dockerfile_alpine @@ -13,8 +13,9 @@ ENV WEBSERVER_PORT=8080 COPY start-container.sh /usr/local/bin/start-container -RUN apk add --no-cache libcurl \ - && docker-php-ext-install ctype curl dom fileinfo filter hash mbstring openssl pcre pdo session tokenizer xml \ +# preinstalled hash openssl pcre tokenizer +RUN apk add --no-cache curl-dev libxml2-dev oniguruma-dev \ + && docker-php-ext-install ctype curl dom fileinfo filter mbstring pdo session xml \ && chmod +x /usr/local/bin/start-container \ && echo "install composer" \ && curl -o composer-setup.php https://getcomposer.org/installer \ -- 2.49.1 From 0366d1891ca7463ac55111da454a784ea6f724db Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 13:03:52 +0200 Subject: [PATCH 21/63] run ok all branches --- .woodpecker/build_alpine.yml | 2 -- .woodpecker/build_ubuntu.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 1cc7e6d..ab4c989 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -1,6 +1,4 @@ when: - branch: - include: [ main, master ] path: include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] cron: nightly diff --git a/.woodpecker/build_ubuntu.yml b/.woodpecker/build_ubuntu.yml index 6246351..c2ce248 100644 --- a/.woodpecker/build_ubuntu.yml +++ b/.woodpecker/build_ubuntu.yml @@ -1,6 +1,4 @@ when: - branch: - include: [ main, master ] path: include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] cron: nightly -- 2.49.1 From e2840e6a831e45b867fe941ab61beea9af391ada Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 13:33:38 +0200 Subject: [PATCH 22/63] install composer and npm from the package-manager --- Dockerfile_alpine | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/Dockerfile_alpine b/Dockerfile_alpine index a61a717..92a0b03 100644 --- a/Dockerfile_alpine +++ b/Dockerfile_alpine @@ -1,11 +1,5 @@ FROM php:8-fpm-alpine -# node version number like "12.22.1" or empty for the latest version -ARG NODE_VERSION='' - -# composer version number like "2.1" or empty for the latest version -ARG COMPOSER_VERSION='' - ENV NVM_DIR="/root/.nvm" # port to for the webserver @@ -13,24 +7,9 @@ ENV WEBSERVER_PORT=8080 COPY start-container.sh /usr/local/bin/start-container -# preinstalled hash openssl pcre tokenizer -RUN apk add --no-cache curl-dev libxml2-dev oniguruma-dev \ +RUN apk add --no-cache curl-dev libxml2-dev oniguruma-dev composer npm \ && docker-php-ext-install ctype curl dom fileinfo filter mbstring pdo session xml \ - && chmod +x /usr/local/bin/start-container \ - && echo "install composer" \ - && curl -o composer-setup.php https://getcomposer.org/installer \ - && curl -o composer-setup.sig https://composer.github.io/installer.sig \ - && echo " composer-setup.php" >> composer-setup.sig \ - && sha384sum -c composer-setup.sig \ - && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ - && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ - && rm composer-setup.php composer-setup.sig /var/www/html/* \ - && echo "install nvm and node" \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ - && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ - && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION; + && chmod +x /usr/local/bin/start-container EXPOSE ${WEBSERVER_PORT} -- 2.49.1 From a7ae8a91d130ffaf583613cecfa105c4ec16b536 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 13:58:31 +0200 Subject: [PATCH 23/63] commands test --- .woodpecker/build_alpine.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index ab4c989..e9ffc08 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -15,6 +15,10 @@ steps: repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-alpine dockerfile: Dockerfile_alpine + commands: + - echo "hello world" + - /usr/local/bin/dockerd-entrypoint.sh plugin-docker-buildx + - echo "goodbye world" when: branch: exclude: [ main, master ] -- 2.49.1 From 67bc4be21a2881a6e3099df8b6a71cc65237e797 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:08:29 +0200 Subject: [PATCH 24/63] commands test --- .woodpecker/build_alpine.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index e9ffc08..ec4d4fd 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -7,14 +7,14 @@ when: steps: dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: + environment: + PLUGIN_USERNAME: vistanarvas + PLUGIN_PASSWORD: from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-alpine - dockerfile: Dockerfile_alpine + PLUGIN_CONTEXT: ./build + PLUGIN_REPO: vistanarvas/${CI_REPO_NAME} + PLUGIN_TAG: ${CI_COMMIT_BRANCH}-alpine + PLUGIN_DOCKERFILE: Dockerfile_alpine commands: - echo "hello world" - /usr/local/bin/dockerd-entrypoint.sh plugin-docker-buildx -- 2.49.1 From d6f7aa5824f0442522d66cfd8212357fd86c80fa Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:18:58 +0200 Subject: [PATCH 25/63] commands test --- .woodpecker/build_alpine.yml | 51 ++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index ec4d4fd..6b4a416 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -5,23 +5,36 @@ when: event: [ cron, release, push, manual ] steps: - dev_alpine_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - environment: - PLUGIN_USERNAME: vistanarvas - PLUGIN_PASSWORD: - from_secret: DOCKERHUB_TOKEN - PLUGIN_CONTEXT: ./build - PLUGIN_REPO: vistanarvas/${CI_REPO_NAME} - PLUGIN_TAG: ${CI_COMMIT_BRANCH}-alpine - PLUGIN_DOCKERFILE: Dockerfile_alpine + test1: + image: php:8-fpm-alpine commands: - - echo "hello world" - - /usr/local/bin/dockerd-entrypoint.sh plugin-docker-buildx - - echo "goodbye world" - when: - branch: - exclude: [ main, master ] - path: - include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] - event: [ push, manual ] \ No newline at end of file + - export TEST="Hello world" + - echo $TEST + - echo ${TEST} + - echo $$TEST + - echo $${TEST} + test2: + image: php:8-fpm-alpine + commands: + - echo $TEST + - echo ${TEST} + - echo $$TEST + - echo $${TEST} + + +# dev_alpine_build_and_publish: +# image: woodpeckerci/plugin-docker-buildx +# settings: +# username: vistanarvas +# password: +# from_secret: DOCKERHUB_TOKEN +# context: ./build +# repo: vistanarvas/${CI_REPO_NAME} +# tag: ${CI_COMMIT_BRANCH}-alpine +# dockerfile: Dockerfile_alpine +# when: +# branch: +# exclude: [ main, master ] +# path: +# include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] +# event: [ push, manual ] \ No newline at end of file -- 2.49.1 From d5f712e8ff757d9054de6c0214d3b9f7db694e0f Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:22:33 +0200 Subject: [PATCH 26/63] commands test --- .woodpecker/build_alpine.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 6b4a416..f63137e 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -10,16 +10,16 @@ steps: commands: - export TEST="Hello world" - echo $TEST - - echo ${TEST} - - echo $$TEST - - echo $${TEST} + - pwd + - ls -al + - touch test test2: image: php:8-fpm-alpine commands: - echo $TEST - - echo ${TEST} - - echo $$TEST - - echo $${TEST} + - pwd + - ls -al + - touch test # dev_alpine_build_and_publish: -- 2.49.1 From f4014cf4663963d608287c518ae62e0c24a576d6 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:23:39 +0200 Subject: [PATCH 27/63] commands test --- .woodpecker/build_alpine.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index f63137e..609c833 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -8,18 +8,8 @@ steps: test1: image: php:8-fpm-alpine commands: - - export TEST="Hello world" - - echo $TEST - - pwd - - ls -al - - touch test - test2: - image: php:8-fpm-alpine - commands: - - echo $TEST - - pwd - - ls -al - - touch test + - docker inspect php:8-fpm-alpine --format='{{.Created}}' + - docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' # dev_alpine_build_and_publish: -- 2.49.1 From 5472f30f008de4f6e11d076bf91d61f239962d9c Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:25:52 +0200 Subject: [PATCH 28/63] commands test --- .woodpecker/build_alpine.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 609c833..ec8650d 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -6,7 +6,7 @@ when: steps: test1: - image: php:8-fpm-alpine + image: docker commands: - docker inspect php:8-fpm-alpine --format='{{.Created}}' - docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' -- 2.49.1 From 4c30285fec618bd72dbbcaa4602d4e2ea7f2d947 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:29:17 +0200 Subject: [PATCH 29/63] commands test --- .woodpecker/build_alpine.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index ec8650d..5b6955d 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -10,6 +10,8 @@ steps: commands: - docker inspect php:8-fpm-alpine --format='{{.Created}}' - docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' + volumes: + - /var/run/docker.sock:/var/run/docker.sock # dev_alpine_build_and_publish: -- 2.49.1 From 12257ae7c17e149c0002113df5ebf220a10c1695 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:30:54 +0200 Subject: [PATCH 30/63] commands test --- .woodpecker/build_alpine.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 5b6955d..10d79c6 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -8,6 +8,8 @@ steps: test1: image: docker commands: + - docker pull php:8-fpm-alpine + - docker pull vistanarvas/simple-laravel:dev-alpine - docker inspect php:8-fpm-alpine --format='{{.Created}}' - docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' volumes: -- 2.49.1 From 9dcc391e6289a8c8a9e7d137275ad1e16c70551d Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:43:36 +0200 Subject: [PATCH 31/63] commands test --- .woodpecker/build_alpine.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 10d79c6..8382442 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -10,8 +10,15 @@ steps: commands: - docker pull php:8-fpm-alpine - docker pull vistanarvas/simple-laravel:dev-alpine - - docker inspect php:8-fpm-alpine --format='{{.Created}}' - - docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' + - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}})' + - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}})' + - echo $BASE_IMG + - echo $PREV_IMG + - BASE_DATE=$(date -d "$BASE_IMG" +%s) + - PREV_DATE=$(date -d "$PREV_IMG" +%s) + - echo $BASE_DATE + - echo $PREV_DATE + - [ "$BASE_DATE" -gt "$PREV_DATE" ]; then echo "BASE is newer"; fi volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.49.1 From bc7375486ea407451ec9ee92b9b2fb51ad77c18c Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:44:07 +0200 Subject: [PATCH 32/63] commands test --- .woodpecker/build_alpine.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 8382442..eaca4a7 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -18,7 +18,7 @@ steps: - PREV_DATE=$(date -d "$PREV_IMG" +%s) - echo $BASE_DATE - echo $PREV_DATE - - [ "$BASE_DATE" -gt "$PREV_DATE" ]; then echo "BASE is newer"; fi + - if [ "$BASE_DATE" -gt "$PREV_DATE" ]; then echo "BASE is newer"; fi volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.49.1 From 6ba1dbc284bee97372b9fc45b5ade17e75c677a5 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:44:59 +0200 Subject: [PATCH 33/63] commands test --- .woodpecker/build_alpine.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index eaca4a7..db11355 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -10,8 +10,8 @@ steps: commands: - docker pull php:8-fpm-alpine - docker pull vistanarvas/simple-laravel:dev-alpine - - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}})' - - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}})' + - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}}') + - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}') - echo $BASE_IMG - echo $PREV_IMG - BASE_DATE=$(date -d "$BASE_IMG" +%s) -- 2.49.1 From 8f5515470806e1a7c3ef0acfef0dc2c3839d7114 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:58:19 +0200 Subject: [PATCH 34/63] commands test --- .woodpecker/build_alpine.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index db11355..0051ef8 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -10,12 +10,12 @@ steps: commands: - docker pull php:8-fpm-alpine - docker pull vistanarvas/simple-laravel:dev-alpine - - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}}') - - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}') + - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}}' | cut -d '.' -f 1) + - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' | cut -d '.' -f 1) - echo $BASE_IMG - echo $PREV_IMG - - BASE_DATE=$(date -d "$BASE_IMG" +%s) - - PREV_DATE=$(date -d "$PREV_IMG" +%s) + - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) + - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - echo $BASE_DATE - echo $PREV_DATE - if [ "$BASE_DATE" -gt "$PREV_DATE" ]; then echo "BASE is newer"; fi -- 2.49.1 From f937cbbd236ff94b79a1b4aba227e331110a3369 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 14:59:12 +0200 Subject: [PATCH 35/63] commands test --- .woodpecker/build_alpine.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 0051ef8..ac05b3c 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -18,7 +18,7 @@ steps: - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - echo $BASE_DATE - echo $PREV_DATE - - if [ "$BASE_DATE" -gt "$PREV_DATE" ]; then echo "BASE is newer"; fi + - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then echo "PREV is newer"; fi volumes: - /var/run/docker.sock:/var/run/docker.sock -- 2.49.1 From c7ff9f4a28e9df720450e066db686814dd777569 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:06:08 +0200 Subject: [PATCH 36/63] commands test --- .woodpecker/build_alpine.yml | 42 ++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index ac05b3c..3c77bd1 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -5,37 +5,33 @@ when: event: [ cron, release, push, manual ] steps: - test1: + cron_pre_check: image: docker commands: - docker pull php:8-fpm-alpine - docker pull vistanarvas/simple-laravel:dev-alpine - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}}' | cut -d '.' -f 1) - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' | cut -d '.' -f 1) - - echo $BASE_IMG - - echo $PREV_IMG - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - - echo $BASE_DATE - - echo $PREV_DATE - - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then echo "PREV is newer"; fi + - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then touch SKIP_BUILD; fi volumes: - /var/run/docker.sock:/var/run/docker.sock - -# dev_alpine_build_and_publish: -# image: woodpeckerci/plugin-docker-buildx -# settings: -# username: vistanarvas -# password: -# from_secret: DOCKERHUB_TOKEN -# context: ./build -# repo: vistanarvas/${CI_REPO_NAME} -# tag: ${CI_COMMIT_BRANCH}-alpine -# dockerfile: Dockerfile_alpine -# when: -# branch: -# exclude: [ main, master ] -# path: -# include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] -# event: [ push, manual ] \ No newline at end of file + dev_alpine_build_and_publish: + image: woodpeckerci/plugin-docker-buildx + settings: + username: vistanarvas + password: + from_secret: DOCKERHUB_TOKEN + context: ./build + repo: vistanarvas/${CI_REPO_NAME} + tag: ${CI_COMMIT_BRANCH}-alpine + dockerfile: Dockerfile_alpine + when: + evaluate: '! test -f "SKIP_BUILD"' + branch: + exclude: [ main, master ] + path: + include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] + event: [ push, manual ] \ No newline at end of file -- 2.49.1 From 8c9563ec987455a1867169d13d6a150d9d93038e Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:07:02 +0200 Subject: [PATCH 37/63] commands test --- .woodpecker/build_alpine.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 3c77bd1..5dba16e 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -29,7 +29,7 @@ steps: tag: ${CI_COMMIT_BRANCH}-alpine dockerfile: Dockerfile_alpine when: - evaluate: '! test -f "SKIP_BUILD"' + evaluate: '! test -f SKIP_BUILD' branch: exclude: [ main, master ] path: -- 2.49.1 From 6eac9c86b636ca39fcfabd79c31ab67db4d4e25f Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:18:32 +0200 Subject: [PATCH 38/63] commands test --- .woodpecker/build_alpine.yml | 44 +++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 5dba16e..636a3bf 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -17,21 +17,33 @@ steps: - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then touch SKIP_BUILD; fi volumes: - /var/run/docker.sock:/var/run/docker.sock - - dev_alpine_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: - from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-alpine - dockerfile: Dockerfile_alpine + test: + image: alpine + commands: + - echo "Hello" + test2: + image: alpine + commands: + - echo "World" when: - evaluate: '! test -f SKIP_BUILD' - branch: - exclude: [ main, master ] path: - include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] - event: [ push, manual ] \ No newline at end of file + include: + - SKIP_BUILD + +# dev_alpine_build_and_publish: +# image: woodpeckerci/plugin-docker-buildx +# settings: +# username: vistanarvas +# password: +# from_secret: DOCKERHUB_TOKEN +# context: ./build +# repo: vistanarvas/${CI_REPO_NAME} +# tag: ${CI_COMMIT_BRANCH}-alpine +# dockerfile: Dockerfile_alpine +# when: +# evaluate: '! test -f SKIP_BUILD' +# branch: +# exclude: [ main, master ] +# path: +# include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] +# event: [ push, manual ] \ No newline at end of file -- 2.49.1 From 60d0d85b2e1eef7f84707145136bab32eea16ec0 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:21:41 +0200 Subject: [PATCH 39/63] commands test --- .woodpecker/build_alpine.yml | 12 ------------ .woodpecker/test.yml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 .woodpecker/test.yml diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 636a3bf..6c8aaf5 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -17,18 +17,6 @@ steps: - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then touch SKIP_BUILD; fi volumes: - /var/run/docker.sock:/var/run/docker.sock - test: - image: alpine - commands: - - echo "Hello" - test2: - image: alpine - commands: - - echo "World" - when: - path: - include: - - SKIP_BUILD # dev_alpine_build_and_publish: # image: woodpeckerci/plugin-docker-buildx diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 0000000..55592bf --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,16 @@ +depends_on: + - build_alpine + +steps: + test: + image: alpine + commands: + - echo "Hello" + test2: + image: alpine + commands: + - echo "World" + when: + path: + include: + - SKIP_BUILD \ No newline at end of file -- 2.49.1 From e2137eb2e62be3199f2c57bd6300b6dcb1670329 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:31:26 +0200 Subject: [PATCH 40/63] commands test --- .woodpecker/build_alpine.yml | 2 +- .woodpecker/test.yml | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 .woodpecker/test.yml diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml index 6c8aaf5..8ef7163 100644 --- a/.woodpecker/build_alpine.yml +++ b/.woodpecker/build_alpine.yml @@ -14,7 +14,7 @@ steps: - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' | cut -d '.' -f 1) - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then touch SKIP_BUILD; fi + - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then exit 1; fi volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml deleted file mode 100644 index 55592bf..0000000 --- a/.woodpecker/test.yml +++ /dev/null @@ -1,16 +0,0 @@ -depends_on: - - build_alpine - -steps: - test: - image: alpine - commands: - - echo "Hello" - test2: - image: alpine - commands: - - echo "World" - when: - path: - include: - - SKIP_BUILD \ No newline at end of file -- 2.49.1 From 8aedf67abada9ba559741d9acdd4bb07e6073694 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:55:16 +0200 Subject: [PATCH 41/63] drop ubuntu build --- .woodpecker/build_alpine.yml | 37 --------------------- .woodpecker/build_dev.yml | 25 +++++++++++++++ .woodpecker/build_release.yml | 41 ++++++++++++++++++++++++ .woodpecker/build_ubuntu.yml | 57 --------------------------------- Dockerfile_alpine => Dockerfile | 4 ++- Dockerfile_ubuntu | 42 ------------------------ build/start-container.sh | 3 -- 7 files changed, 69 insertions(+), 140 deletions(-) delete mode 100644 .woodpecker/build_alpine.yml create mode 100644 .woodpecker/build_dev.yml create mode 100644 .woodpecker/build_release.yml delete mode 100644 .woodpecker/build_ubuntu.yml rename Dockerfile_alpine => Dockerfile (91%) delete mode 100644 Dockerfile_ubuntu diff --git a/.woodpecker/build_alpine.yml b/.woodpecker/build_alpine.yml deleted file mode 100644 index 8ef7163..0000000 --- a/.woodpecker/build_alpine.yml +++ /dev/null @@ -1,37 +0,0 @@ -when: - path: - include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] - cron: nightly - event: [ cron, release, push, manual ] - -steps: - cron_pre_check: - image: docker - commands: - - docker pull php:8-fpm-alpine - - docker pull vistanarvas/simple-laravel:dev-alpine - - BASE_IMG=$(docker inspect php:8-fpm-alpine --format='{{.Created}}' | cut -d '.' -f 1) - - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:dev-alpine --format='{{.Created}}' | cut -d '.' -f 1) - - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) - - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then exit 1; fi - volumes: - - /var/run/docker.sock:/var/run/docker.sock - -# dev_alpine_build_and_publish: -# image: woodpeckerci/plugin-docker-buildx -# settings: -# username: vistanarvas -# password: -# from_secret: DOCKERHUB_TOKEN -# context: ./build -# repo: vistanarvas/${CI_REPO_NAME} -# tag: ${CI_COMMIT_BRANCH}-alpine -# dockerfile: Dockerfile_alpine -# when: -# evaluate: '! test -f SKIP_BUILD' -# branch: -# exclude: [ main, master ] -# path: -# include: [ '.woodpecker/build_alpine.yml', 'build/*', 'Dockerfile_alpine' ] -# event: [ push, manual ] \ No newline at end of file diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml new file mode 100644 index 0000000..53ee139 --- /dev/null +++ b/.woodpecker/build_dev.yml @@ -0,0 +1,25 @@ +matrix: + PHP_VERSION: + - latest + +when: + branch: + exclude: [ main, master ] + path: + include: [ '.woodpecker/build_dev.yml', 'build/*', 'Dockerfile' ] + cron: nightly + event: [ push, manual ] + +steps: + dev_alpine_build_and_publish: + image: woodpeckerci/plugin-docker-buildx + settings: + username: vistanarvas + password: + from_secret: DOCKERHUB_TOKEN + context: ./build + repo: vistanarvas/${CI_REPO_NAME} + tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} + dockerfile: Dockerfile_alpine + build_args: + PHP_VERSION: ${PHP_VERSION} \ No newline at end of file diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml new file mode 100644 index 0000000..f519f9f --- /dev/null +++ b/.woodpecker/build_release.yml @@ -0,0 +1,41 @@ +matrix: + PHP_VERSION: + - latest + - 8-fpm-alpine + - 8.3-fpm-alpine + - 8.2-fpm-alpine + - 8.1-fpm-alpine + +when: + branch: + include: [ main, master ] + cron: nightly + event: [ cron, release, manual ] + +steps: + cron_pre_check: + image: docker + commands: + - docker pull php:${PHP_VERSION} + - docker pull vistanarvas/simple-laravel:${PHP_VERSION} + - BASE_IMG=$(docker inspect php:${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1) + - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1) + - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) + - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) + - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then echo "no rebuild needed"; exit 1; fi + volumes: + - /var/run/docker.sock:/var/run/docker.sock + when: + cron: nightly + event: [ cron ] + + release_alpine_build_and_publish: + image: woodpeckerci/plugin-docker-buildx + settings: + username: vistanarvas + password: + from_secret: DOCKERHUB_TOKEN + context: ./build + repo: vistanarvas/${CI_REPO_NAME} + tag: ${PHP_VERSION} + dockerfile: Dockerfile_alpine \ No newline at end of file diff --git a/.woodpecker/build_ubuntu.yml b/.woodpecker/build_ubuntu.yml deleted file mode 100644 index c2ce248..0000000 --- a/.woodpecker/build_ubuntu.yml +++ /dev/null @@ -1,57 +0,0 @@ -when: - path: - include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] - cron: nightly - event: [ cron, release, push, manual ] - -steps: - release_ubuntu_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: - from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - auto_tag: true - default_suffix: -ubuntu - dockerfile: Dockerfile_ubuntu - when: - branch: - include: [ main, master ] - event: release - - cron_ubuntu_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: - from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - tag: nightly-ubuntu - dockerfile: Dockerfile_ubuntu - when: - branch: - include: [ main, master ] - path: - include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] - cron: nightly - event: [ cron ] - - dev_ubuntu_build_and_publish: - image: woodpeckerci/plugin-docker-buildx - settings: - username: vistanarvas - password: - from_secret: DOCKERHUB_TOKEN - context: ./build - repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-ubuntu - dockerfile: Dockerfile_ubuntu - when: - branch: - exclude: [ main, master ] - path: - include: [ '.woodpecker/build_ubuntu.yml', 'build/*', 'Dockerfile_ubuntu' ] - event: [ push, manual ] \ No newline at end of file diff --git a/Dockerfile_alpine b/Dockerfile similarity index 91% rename from Dockerfile_alpine rename to Dockerfile index 92a0b03..0f1fc30 100644 --- a/Dockerfile_alpine +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM php:8-fpm-alpine +ARG PHP_VERSION + +FROM php:$PHP_VERSION ENV NVM_DIR="/root/.nvm" diff --git a/Dockerfile_ubuntu b/Dockerfile_ubuntu deleted file mode 100644 index ba24d90..0000000 --- a/Dockerfile_ubuntu +++ /dev/null @@ -1,42 +0,0 @@ -FROM ubuntu:latest - -# node version number like "12.22.1" or empty for the latest version -ARG NODE_VERSION='' - -# composer version number like "2.1" or empty for the latest version -ARG COMPOSER_VERSION='' - -# disables asking for input -ARG DEBIAN_FRONTEND="noninteractive" - -ENV NVM_DIR="/root/.nvm" - -# port to for the webserver -ENV WEBSERVER_PORT=8080 - -COPY start-container.sh /usr/local/bin/start-container - -RUN apt-get -y update \ - && apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql php-gd php-zip php-bcmath php-intl \ - && apt-get clean \ - && chmod +x /usr/local/bin/start-container \ - && echo "install composer" \ - && curl -o composer-setup.php https://getcomposer.org/installer \ - && curl -o composer-setup.sig https://composer.github.io/installer.sig \ - && echo " composer-setup.php" >> composer-setup.sig \ - && sha384sum -c composer-setup.sig \ - && if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \ - && php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \ - && rm composer-setup.php composer-setup.sig /var/www/html/* \ - && echo "install nvm and node" \ - && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ - && if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \ - && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION; - -EXPOSE ${WEBSERVER_PORT} - -WORKDIR /var/www/html - -ENTRYPOINT ["start-container"] \ No newline at end of file diff --git a/build/start-container.sh b/build/start-container.sh index ce773fb..e7abf6d 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -3,9 +3,6 @@ # exit when any command fails set -e -# init nvm -\. "$NVM_DIR"/nvm.sh - if [[ "$BOOT_NPM_INSTALL" = true ]]; then echo "npm install" npm install -- 2.49.1 From 235d692f3bea84f7fa9685b699a2f9f226d0792c Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:56:17 +0200 Subject: [PATCH 42/63] drop ubuntu build --- .woodpecker/build_dev.yml | 1 - .woodpecker/build_release.yml | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 53ee139..03c1f9b 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -20,6 +20,5 @@ steps: context: ./build repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} - dockerfile: Dockerfile_alpine build_args: PHP_VERSION: ${PHP_VERSION} \ No newline at end of file diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index f519f9f..36e079b 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -37,5 +37,4 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: ${PHP_VERSION} - dockerfile: Dockerfile_alpine \ No newline at end of file + tag: ${PHP_VERSION} \ No newline at end of file -- 2.49.1 From ce1ccad16d3f91715941f5afe66072b644d46913 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:58:35 +0200 Subject: [PATCH 43/63] fix: dynamic from --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0f1fc30..89f90ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG PHP_VERSION -FROM php:$PHP_VERSION +FROM php:${PHP_VERSION} ENV NVM_DIR="/root/.nvm" -- 2.49.1 From d2a42e790a6327b96887a61c4177ccebceb7ac34 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 15:59:46 +0200 Subject: [PATCH 44/63] fix: dynamic from --- .woodpecker/build_dev.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 03c1f9b..c387aa2 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -21,4 +21,4 @@ steps: repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} build_args: - PHP_VERSION: ${PHP_VERSION} \ No newline at end of file + PHP_VERSION: "php:${PHP_VERSION}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 89f90ce..398e4be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG PHP_VERSION -FROM php:${PHP_VERSION} +FROM ${PHP_VERSION} ENV NVM_DIR="/root/.nvm" -- 2.49.1 From f513ac31be1c5e1da054eee093df7e586261816f Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:00:40 +0200 Subject: [PATCH 45/63] fix: dynamic from --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 398e4be..1b36263 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ ARG PHP_VERSION +RUN echo ${PHP_VERSION}; +RUN echo $PHP_VERSION; + FROM ${PHP_VERSION} ENV NVM_DIR="/root/.nvm" -- 2.49.1 From ed046e5d7effc0d2ff72e284f059f17c9e7d0820 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:03:46 +0200 Subject: [PATCH 46/63] dynamic FROM test --- Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b36263..2a5365f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ ARG PHP_VERSION -RUN echo ${PHP_VERSION}; +FROM php:latest + +RUN echo PHP_VERSION; RUN echo $PHP_VERSION; - -FROM ${PHP_VERSION} - -ENV NVM_DIR="/root/.nvm" +RUN echo ${PHP_VERSION}; # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From 67c02c8af1334640de580f5f15e343b12a55ae48 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:05:56 +0200 Subject: [PATCH 47/63] dynamic FROM test --- .woodpecker/build_dev.yml | 2 +- Dockerfile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index c387aa2..f996649 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -21,4 +21,4 @@ steps: repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} build_args: - PHP_VERSION: "php:${PHP_VERSION}" \ No newline at end of file + BASE_VERSION: "php:${PHP_VERSION}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2a5365f..6f5605b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -ARG PHP_VERSION +ARG BASE_VERSION FROM php:latest -RUN echo PHP_VERSION; -RUN echo $PHP_VERSION; -RUN echo ${PHP_VERSION}; +RUN echo BASE_VERSION; +RUN echo $BASE_VERSION; +RUN echo ${BASE_VERSION}; # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From ea1db4fa0c0f422e308502a11c1eef1d3fca61d5 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:09:34 +0200 Subject: [PATCH 48/63] dynamic FROM test --- .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 f996649..1b51ac3 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -21,4 +21,4 @@ steps: repo: vistanarvas/${CI_REPO_NAME} tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} build_args: - BASE_VERSION: "php:${PHP_VERSION}" \ No newline at end of file + - BASE_VERSION=php:${PHP_VERSION} \ No newline at end of file -- 2.49.1 From c00077252c922b9863bba570b0b8efbefc42046b Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:11:36 +0200 Subject: [PATCH 49/63] dynamic FROM test --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f5605b..f3af1ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -ARG BASE_VERSION - FROM php:latest +ARG BASE_VERSION + RUN echo BASE_VERSION; RUN echo $BASE_VERSION; RUN echo ${BASE_VERSION}; +RUB exit; + # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From 37f62ee64c96d7b2b653b82e2a6721c829186fcc Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:12:20 +0200 Subject: [PATCH 50/63] dynamic FROM test --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f3af1ed..fe47bdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN echo BASE_VERSION; RUN echo $BASE_VERSION; RUN echo ${BASE_VERSION}; -RUB exit; +RUN exit; # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From 651798c843ac8b123d68a1e2b551e4e1f7cfa81f Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:13:53 +0200 Subject: [PATCH 51/63] dynamic FROM test --- Dockerfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe47bdc..e5e29ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,6 @@ -FROM php:latest - ARG BASE_VERSION -RUN echo BASE_VERSION; -RUN echo $BASE_VERSION; -RUN echo ${BASE_VERSION}; - -RUN exit; +FROM $BASE_VERSION # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From ee86e83bee04649c9ce9996786715831483053ea Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:18:26 +0200 Subject: [PATCH 52/63] dynamic FROM --- .woodpecker/build_dev.yml | 6 +++--- .woodpecker/build_release.yml | 19 +++++++++---------- Dockerfile | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 1b51ac3..22fae6b 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -1,6 +1,6 @@ matrix: PHP_VERSION: - - latest + - 8 when: branch: @@ -19,6 +19,6 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-${PHP_VERSION} + tag: ${CI_COMMIT_BRANCH}-php-${PHP_VERSION} build_args: - - BASE_VERSION=php:${PHP_VERSION} \ No newline at end of file + - BASE_VERSION=${PHP_VERSION} \ No newline at end of file diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index 36e079b..4a0b80d 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -1,10 +1,9 @@ matrix: PHP_VERSION: - - latest - - 8-fpm-alpine - - 8.3-fpm-alpine - - 8.2-fpm-alpine - - 8.1-fpm-alpine + - 8 + - 8.3 + - 8.2 + - 8.1 when: branch: @@ -16,10 +15,10 @@ steps: cron_pre_check: image: docker commands: - - docker pull php:${PHP_VERSION} - - docker pull vistanarvas/simple-laravel:${PHP_VERSION} - - BASE_IMG=$(docker inspect php:${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1) - - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1) + - docker pull php:${PHP_VERSION}-fpm-alpine + - docker pull vistanarvas/simple-laravel:${PHP_VERSION}-fpm-alpine + - BASE_IMG=$(docker inspect php:${PHP_VERSION}-fpm-alpine --format='{{.Created}}' | cut -d '.' -f 1) + - PREV_IMG=$(docker inspect vistanarvas/simple-laravel:php-${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1) - BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s) - PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s) - if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then echo "no rebuild needed"; exit 1; fi @@ -37,4 +36,4 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: ${PHP_VERSION} \ No newline at end of file + tag: php-${PHP_VERSION} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e5e29ae..7420477 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG BASE_VERSION -FROM $BASE_VERSION +FROM php:${BASE_VERSION}-fpm-alpine # port to for the webserver ENV WEBSERVER_PORT=8080 -- 2.49.1 From 5b726223ed56c26c2ce41332a84ecfbad76dbac1 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:21:36 +0200 Subject: [PATCH 53/63] dev does not run cron [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 22fae6b..9f84d81 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -7,7 +7,6 @@ when: exclude: [ main, master ] path: include: [ '.woodpecker/build_dev.yml', 'build/*', 'Dockerfile' ] - cron: nightly event: [ push, manual ] steps: -- 2.49.1 From 1681e3d92653ee3514cb02ecc4b8398c5f0cbd15 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 16:41:22 +0200 Subject: [PATCH 54/63] install extra packages and extensions on first boot --- build/start-container.sh | 11 +++++++++++ docker-compose.yml | 2 ++ 2 files changed, 13 insertions(+) diff --git a/build/start-container.sh b/build/start-container.sh index e7abf6d..7f22fc0 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -3,6 +3,17 @@ # exit when any command fails set -e +# install extra packages and extensions on first boot +if [[ ! -f /etc/first_boot ]]; then + if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then + apk add --no-cache "$EXTRA_APK_PACKAGES" + fi + if [[ -n "${EXTRA_PHP_EXTENSIONS// /}" ]]; then + docker-php-ext-install "$EXTRA_PHP_EXTENSIONS" + fi + touch /etc/first_boot +fi + if [[ "$BOOT_NPM_INSTALL" = true ]]; then echo "npm install" npm install diff --git a/docker-compose.yml b/docker-compose.yml index ce008c0..438ba01 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,8 @@ services: BOOT_NPM_DEV: true # also starts `npm dev` BOOT_NPM_INSTALL: true # runs `npm install` on boot BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot + #EXTRA_APK_PACKAGES: # string with extra packages to install on first boot example: "git python" + #EXTRA_PHP_EXTENSIONS: # string with extra php extensions to install on first boot depends_on: - mysql - redis -- 2.49.1 From 3510e1a279ae0ab6ccb39d32ca33d23e7e965aa3 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Thu, 22 Aug 2024 17:07:15 +0200 Subject: [PATCH 55/63] switch to ash --- 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 7f22fc0..e60fb2a 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env ash # exit when any command fails set -e -- 2.49.1 From 0a9a900ee7e75ed4e2374994957b2eda463ce8fc Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 10:00:32 +0200 Subject: [PATCH 56/63] allow want word splitting for packages and extensions --- build/start-container.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/start-container.sh b/build/start-container.sh index e60fb2a..2ea4966 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -6,10 +6,12 @@ set -e # install extra packages and extensions on first boot if [[ ! -f /etc/first_boot ]]; then if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then - apk add --no-cache "$EXTRA_APK_PACKAGES" + # shellcheck disable=SC2086 + apk add --no-cache $EXTRA_APK_PACKAGES fi if [[ -n "${EXTRA_PHP_EXTENSIONS// /}" ]]; then - docker-php-ext-install "$EXTRA_PHP_EXTENSIONS" + # shellcheck disable=SC2086 + docker-php-ext-install $EXTRA_PHP_EXTENSIONS fi touch /etc/first_boot fi -- 2.49.1 From b4fb921549551023408170b652183b19bae9e9ab Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 10:19:09 +0200 Subject: [PATCH 57/63] change example --- docker-compose.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 438ba01..9406d14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,10 @@ services: BOOT_NPM_DEV: true # also starts `npm dev` BOOT_NPM_INSTALL: true # runs `npm install` on boot BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot - #EXTRA_APK_PACKAGES: # string with extra packages to install on first boot example: "git python" - #EXTRA_PHP_EXTENSIONS: # string with extra php extensions to install on first boot + + # Extra packages and php extensions to install on first boot + # EXTRA_APK_PACKAGES: # example: libpng-dev icu-dev + # EXTRA_PHP_EXTENSIONS: # example: exif intl bcmath gd pdo_mysql depends_on: - mysql - redis -- 2.49.1 From 119d49f46bd6a5cdd736d70efe30176a2742a1bb Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 10:37:10 +0200 Subject: [PATCH 58/63] change image tags --- .woodpecker/build_dev.yml | 2 +- .woodpecker/build_release.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 9f84d81..794e833 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -18,6 +18,6 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: ${CI_COMMIT_BRANCH}-php-${PHP_VERSION} + tag: test-${CI_COMMIT_BRANCH}-php-${PHP_VERSION} build_args: - BASE_VERSION=${PHP_VERSION} \ No newline at end of file diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index 4a0b80d..ec568cf 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -7,7 +7,7 @@ matrix: when: branch: - include: [ main, master ] + include: [ master ] cron: nightly event: [ cron, release, manual ] @@ -36,4 +36,5 @@ steps: from_secret: DOCKERHUB_TOKEN context: ./build repo: vistanarvas/${CI_REPO_NAME} - tag: php-${PHP_VERSION} \ No newline at end of file + auto_tag: true + auto_tag_suffix: -php-${PHP_VERSION} \ No newline at end of file -- 2.49.1 From f908ab0ddc9a89aa87fa0def69be2b0940713bab Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 15:13:40 +0200 Subject: [PATCH 59/63] composer before npm --- 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 2ea4966..38c8251 100644 --- a/build/start-container.sh +++ b/build/start-container.sh @@ -16,16 +16,16 @@ if [[ ! -f /etc/first_boot ]]; then touch /etc/first_boot fi -if [[ "$BOOT_NPM_INSTALL" = true ]]; then - echo "npm install" - npm install -fi - if [[ "$BOOT_COMPOSER_INSTALL" = true ]]; then echo "composer install" composer install fi +if [[ "$BOOT_NPM_INSTALL" = true ]]; then + echo "npm install" + npm install +fi + if [ ! -f /var/www/html/artisan ]; then echo "No existing Laravel project found" exit -- 2.49.1 From fa92353bee0bb1cf6a4672fb980bfa9b45356180 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 15:14:02 +0200 Subject: [PATCH 60/63] switch from docker-php scripts to apk add --- Dockerfile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7420477..dab8e2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,25 @@ ENV WEBSERVER_PORT=8080 COPY start-container.sh /usr/local/bin/start-container -RUN apk add --no-cache curl-dev libxml2-dev oniguruma-dev composer npm \ - && docker-php-ext-install ctype curl dom fileinfo filter mbstring pdo session xml \ +RUN apk add --no-cache \ + curl-dev \ + libxml2-dev \ + oniguruma-dev \ + libpng-dev \ + icu-dev \ + php-ctype \ + php-curl \ + php-dom \ + php-fileinfo \ + php-filter \ + php-mbstring \ + php-session \ + php-xml \ + php-intl \ + php-bcmath \ + php-pdo_mysql \ + composer \ + npm \ && chmod +x /usr/local/bin/start-container EXPOSE ${WEBSERVER_PORT} -- 2.49.1 From b967a410e67342e65e487d74fef49efd542e52f7 Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 15:16:00 +0200 Subject: [PATCH 61/63] install filter using docker-php script --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dab8e2e..57e6916 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ RUN apk add --no-cache \ php-curl \ php-dom \ php-fileinfo \ - php-filter \ php-mbstring \ php-session \ php-xml \ @@ -26,6 +25,7 @@ RUN apk add --no-cache \ php-pdo_mysql \ composer \ npm \ + && docker-php-ext-install filter \ && chmod +x /usr/local/bin/start-container EXPOSE ${WEBSERVER_PORT} -- 2.49.1 From 256413205ce2bb84ec243ce1de008bbd243eae3d Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 15:21:10 +0200 Subject: [PATCH 62/63] add missing extensions --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 57e6916..f3360b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,9 @@ RUN apk add --no-cache \ php-intl \ php-bcmath \ php-pdo_mysql \ + php-exif \ + php-xmlwriter \ + php-tokenizer \ composer \ npm \ && docker-php-ext-install filter \ -- 2.49.1 From 41d81b8d4c4cbbf8c4d1805a905bfd13404eb22b Mon Sep 17 00:00:00 2001 From: Ruben Momoa Date: Fri, 23 Aug 2024 15:28:16 +0200 Subject: [PATCH 63/63] install pdo_mysql using docker-php script --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3360b2..d60ea31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,13 +22,12 @@ RUN apk add --no-cache \ php-xml \ php-intl \ php-bcmath \ - php-pdo_mysql \ php-exif \ php-xmlwriter \ php-tokenizer \ composer \ npm \ - && docker-php-ext-install filter \ + && docker-php-ext-install filter pdo_mysql \ && chmod +x /usr/local/bin/start-container EXPOSE ${WEBSERVER_PORT} -- 2.49.1