Compare commits

..

2 Commits

Author SHA1 Message Date
345cf31bb3
build and push docker image in one step
All checks were successful
mapguesser/pipeline/pr-develop This commit looks good
2023-09-26 22:00:18 +02:00
c7f5ea0d85
set runner user of web service 2023-09-26 21:56:29 +02:00
2 changed files with 9 additions and 11 deletions

18
Jenkinsfile vendored
View File

@ -67,18 +67,16 @@ pipeline {
script {
sh script: 'git clean -ffdx', label: 'Clean repository'
def version = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
def imageUrl = "git.esoko.eu/esoko/mapguesser:${version}"
sh script: """docker buildx build \
-t ${imageUrl} \
-f docker/Dockerfile \
--target mapg_release \
.""",
label: 'Build Docker image'
env.VERSION = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) {
sh script: "docker push ${imageUrl}", label: 'Push Docker image to registry'
sh script: """docker buildx build \
-f docker/Dockerfile \
--target mapg_release \
-t git.esoko.eu/esoko/mapguesser:${env.VERSION} \
--push \
.""",
label: 'Build Docker image'
}
}
}

View File

@ -8,7 +8,7 @@ echo "Migrating DB..."
echo "Installing crontab..."
/usr/bin/crontab docker/scripts/cron
echo "Set runner user..."
echo "Set runner user based on owner of .env..."
USER_UID=$(stat -c "%u" .env)
USER_GID=$(stat -c "%g" .env)
groupadd --gid $USER_GID mapg