From f624545dfdbb997d6faae49ff83b61e044ad88fe Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 6 Jun 2023 00:16:19 +0200 Subject: [PATCH] rebase on php:8.1 --- Dockerfile => Containerfile | 38 ++++++++++++++++++++------ Jenkinsfile | 54 +++++++++++++++---------------------- asset-notes.txt | 34 ----------------------- entrypoint.sh | 2 +- 4 files changed, 53 insertions(+), 75 deletions(-) rename Dockerfile => Containerfile (55%) delete mode 100644 asset-notes.txt diff --git a/Dockerfile b/Containerfile similarity index 55% rename from Dockerfile rename to Containerfile index f4262d5..aa74750 100644 --- a/Dockerfile +++ b/Containerfile @@ -1,17 +1,28 @@ -FROM reg.zknt.org/zknt/debian-php:8.1 as builder +FROM docker.io/php:8.1-apache-bullseye as builder ARG DATE -ENV PHPVER=8.1 ENV IP_PATCH=a665f449bfad129b0e20d3f2b386e30332452b40 ENV DISCOVERY_PATCH=4c82fa3e0a2d0a94417cd6b1637893c92f1b1bd5 ENV GITHUB_PATCH=920b06f6f16c22b32c8e2a14772fc053fbb973bb RUN set -xe;\ - apt-install git unzip php${PHPVER}-curl php${PHPVER}-zip php${PHPVER}-bcmath php${PHPVER}-intl php${PHPVER}-mbstring php${PHPVER}-xml + apt-get update &&\ + apt-get install --no-install-recommends -y git locales libcurl4-openssl-dev libzip-dev libicu-dev libxml2-dev libjpeg62-turbo-dev libpng-dev libmagickwand-dev libpq-dev libxpm-dev libwebp-dev &&\ + apt-get clean all &&\ + rm -rf /var/lib/apt/lists/* + +RUN set -xe;\ + docker-php-ext-configure mbstring --disable-mbregex &&\ + docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm &&\ + docker-php-ext-install -j$(nproc) curl zip bcmath intl mbstring xml pcntl gd mysqli pdo_mysql pdo_pgsql &&\ + pecl install imagick &&\ + pecl install redis &&\ + docker-php-ext-enable imagick redis RUN set -xe;\ curl https://raw.githubusercontent.com/composer/getcomposer.org/0a51b6fe383f7f61cf1d250c742ec655aa044c94/web/installer | php -- --quiet --2.2 &&\ mv composer.phar /usr/local/bin/composer + RUN set -xe;\ cd /var && rm -rf www &&\ git clone https://github.com/pixelfed/pixelfed.git www &&\ @@ -25,18 +36,29 @@ RUN set -xe;\ cp -r storage storage.skel &&\ rm -rf .git tests contrib CHANGELOG.md LICENSE .circleci .dependabot .github CODE_OF_CONDUCT.md .env.docker CONTRIBUTING.md README.md docker-compose.yml .env.testing phpunit.xml .env.example .gitignore .editorconfig .gitattributes .dockerignore -FROM reg.zknt.org/zknt/debian-php:8.1 -ENV PHPVER=8.1 +FROM docker.io/php:8.1-apache-bullseye +ARG DATE + COPY --from=builder /var/www /var/www COPY entrypoint.sh /entrypoint.sh COPY worker-entrypoint.sh /worker-entrypoint.sh COPY websockets-entrypoint.sh /websockets-entrypoint.sh COPY wait-for-db.php /wait-for-db.php -RUN apt-install php${PHPVER}-curl php${PHPVER}-zip php${PHPVER}-bcmath php${PHPVER}-intl php${PHPVER}-mbstring php${PHPVER}-xml optipng pngquant jpegoptim gifsicle ffmpeg php${PHPVER}-imagick php${PHPVER}-gd php${PHPVER}-redis php${PHPVER}-mysql php${PHPVER}-pgsql &&\ +COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20210902 /usr/local/lib/php/extensions/no-debug-non-zts-20210902 +COPY --from=builder /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d + +RUN set -xe;\ + apt-get update &&\ + apt-get install --no-install-recommends -y libzip4 libpq5 libmagickwand-6.q16-6 libxpm4 libwebp6 &&\ + apt-get install --no-install-recommends -y optipng pngquant jpegoptim gifsicle ffmpeg locales gosu dumb-init &&\ + apt-get clean all &&\ + rm -rf /var/lib/apt/lists/* + +RUN set -xe;\ a2enmod rewrite &&\ sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf &&\ - sed -i 's/^post_max_size.*/post_max_size = 100M/g' /etc/php/${PHPVER}/apache2/php.ini &&\ - sed -i 's/^upload_max_filesize.*/upload_max_filesize = 100M/g' /etc/php/${PHPVER}/apache2/php.ini + sed -i 's/^post_max_size.*/post_max_size = 100M/g' /usr/local/etc/php/php.ini* &&\ + sed -i 's/^upload_max_filesize.*/upload_max_filesize = 100M/g' /usr/local/etc/php/php.ini* WORKDIR /var/www VOLUME /var/www/storage /var/www/bootstrap ENTRYPOINT /entrypoint.sh diff --git a/Jenkinsfile b/Jenkinsfile index 0d76b9d..664f34d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,41 +2,34 @@ version = "" project = "pixelfed" repo = "zknt" registry = "reg.zknt.org" -registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5" timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC')) pipeline { agent any - triggers { - upstream(upstreamProjects: "../debian-php-81/trunk", threshold: hudson.model.Result.SUCCESS) + environment { + ZKNT_CRED = credentials("6ff44976-23cd-4cc2-902c-de8c340e65e5") + IO_CRED = credentials("3deeee3d-6fce-4430-98dd-9b4db56f43f7") + QUAY_CRED = credentials("18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a") } stages { stage('Build image') { steps { - withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) { - script { - version = timeStamp - def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .") - customImage.push(version) - customImage.push("latest") - def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7" - withDockerRegistry([ credentialsId: io_registry_credentials ]) { - def io_registry_image = repo + '/' + project + ':' + version - sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image - sh "docker push " + io_registry_image - sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + ":latest" - sh "docker push " + io_registry_image.split(/\:/)[0] + ":latest" - } - - def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a" - withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) { - def quay_image = 'quay.io/' + repo + '/' + project + ':' + version - sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image - sh "docker push " + quay_image - sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image.split(/\:/)[0] + ":latest" - sh "docker push " + quay_image.split(/\:/)[0] + ":latest" - } - } + script { + sh "buildah login -u " + ZKNT_CRED_USR + " -p " + ZKNT_CRED_PSW + " reg.zknt.org" + def image = registry + '/' + repo + '/' + project + sh "buildah bud -f Containerfile --build-arg DATE=$timeStamp -t pixelfed:test" + sh "buildah tag pixelfed:test reg.zknt.org/zknt/pixelfed:test" + sh "buildah push " + image + ':test' + } + script { + sh "buildah login -u $IO_CRED_USR -p $IO_CRED_PSW docker.io" + sh "buildah tag pixelfed:test docker.io/zknt/pixelfed:test" + sh "buildah push docker.io/zknt/pixelfed:test" + } + script { + sh "buildah login -u $QUAY_CRED_USR -p $QUAY_CRED_PSW quay.io" + sh "buildah tag pixelfed:test quay.io/zknt/pixelfed:test" + sh "buildah push quay.io/zknt/pixelfed:test" } } } @@ -44,10 +37,7 @@ pipeline { post { always { - sh """docker container prune -f""" - sh """docker image prune -f""" - sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)""" - sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2 | grep -vi -e SCRATCH -e bootstrapped | uniq); do docker rmi -f \$(docker images -q \${image}); done""" + sh """buildah prune -a""" emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+version+'): ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true } } @@ -75,4 +65,4 @@ pipeline { ] ])) } -} \ No newline at end of file +} diff --git a/asset-notes.txt b/asset-notes.txt deleted file mode 100644 index bfdbb05..0000000 --- a/asset-notes.txt +++ /dev/null @@ -1,34 +0,0 @@ -# compile assets - -add to webpack.mix.js: `.js('resources/assets/js/components/**/*.vue', 'public/js').vue()` -oder nur .vue()? - - - composer install --prefer-dist --no-interaction --no-ansi --no-dev --optimize-autoloader - npm install - export PATH=$(pwd)/node_modules/.bin:$PATH - mix --production - - -[webpack-cli] Error: Prevent writing to file that only differs in casing or query string from already written file. -This will lead to a race-condition and corrupted files on case-insensitive file systems. -/pixelfed/public/js/Activity.js -/pixelfed/public/js/activity.js - at checkSimilarFile (/pixelfed/node_modules/webpack/lib/Compiler.js:666:11) - at writeOut (/pixelfed/node_modules/webpack/lib/Compiler.js:848:11) - at /pixelfed/node_modules/webpack/lib/util/fs.js:242:5 - at FSReqCallback.oncomplete (node:fs:189:23) - - -apk add php7 git npm -apk add php7-json php7-phar php7-mbstring php7-openssl php7-dom php7-simplexml php7-xmlreader php7-zip php7-fileinfo php7-curl php7-tokenizer php7-bcmath php7-intl php7-pcntl php7-sodium php7-pdo php7-posix -curl -s https://getcomposer.org/installer | php -mv composer.phar /usr/local/bin/composer -git clone https://github.com/pixelfed/pixelfed.git -cd /pixelfed -composer install --prefer-dist --no-interaction --no-ansi --no-dev --optimize-autoloader -npm install -rm -rf public/js -export PATH=$(pwd)/node_modules/.bin:$PATH -sed -i "s/.extract([/a.vue().extract([/" webpack.mix.js -mix --production diff --git a/entrypoint.sh b/entrypoint.sh index 5f92f49..07d1d9d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -40,4 +40,4 @@ gosu www-data php artisan instance:actor echo "++++ Start apache... ++++" source /etc/apache2/envvars -/usr/local/sbin/dumb-init apache2 -DFOREGROUND +dumb-init apache2 -DFOREGROUND