From bf4f37a17de640676dfb13e045d3298163ac20b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Tue, 26 Sep 2023 02:02:39 +0200 Subject: [PATCH] release test --- Jenkinsfile | 26 +++++++++++++++++++++----- docker/Dockerfile | 2 +- docker/scripts/release.sh | 2 -- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e5b799e..8069187 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,20 +62,36 @@ pipeline { } } - stage('Release Docker image') { + stage('Prepare Docker release') { + environment { + COMPOSER_HOME="${WORKSPACE}/.composer" + } + agent { + dockerfile { + filename 'docker/Dockerfile' + dir '.' + additionalBuildArgs '--target mapg_base' + reuseNode true + } + } steps { script { sh script: 'git clean -ffdx', label: 'Clean repository' + env.VERSION = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim() + sh script: 'docker/scripts/release.sh', label: 'Release script' + } + } + } - def version = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim() - def imageUrl = "git.esoko.eu/esoko/mapguesser:${version}" - + stage('Release Docker image') { + steps { + script { withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) { sh script: """docker buildx build \ --platform linux/amd64,linux/arm64 \ -f docker/Dockerfile \ --target mapg_release \ - -t ${imageUrl} \ + -t git.esoko.eu/esoko/mapguesser:${env.VERSION} \ --push \ .""", label: 'Build Docker image' diff --git a/docker/Dockerfile b/docker/Dockerfile index cfa360e..76300cf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,7 +36,7 @@ RUN apt update --fix-missing && apt install -y cron WORKDIR /var/www/mapguesser COPY ./ /var/www/mapguesser -RUN docker/scripts/release.sh &&\ +RUN chmod 777 /var/www/mapguesser/cache &&\ rm -rf /var/www/mapguesser/.git /var/www/mapguesser/.env EXPOSE 80 diff --git a/docker/scripts/release.sh b/docker/scripts/release.sh index 27aad4b..6594b21 100755 --- a/docker/scripts/release.sh +++ b/docker/scripts/release.sh @@ -2,8 +2,6 @@ set -e -chmod 777 cache - echo "Installing Composer packages..." composer create-project --no-dev