From 0066384036d07497a8f3cc96b1242ab58f311cc4 Mon Sep 17 00:00:00 2001 From: William Petit Date: Thu, 6 Jul 2023 09:33:52 -0600 Subject: [PATCH] chore(ci): release docker image --- Jenkinsfile | 28 +++++++++++++++++++++++++++- misc/jenkins/Dockerfile | 12 +++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 868ed14..bcddc7f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { } } - stage('Release') { + stage('Release binaries and packages') { when { anyOf { branch 'master' @@ -50,6 +50,32 @@ pipeline { } } } + + stage('Build and release Docker image') { + when { + anyOf { + branch 'master' + branch 'develop' + branch 'PR-7' + } + } + steps { + script { + withCredentials([ + usernamePassword([ + credentialsId: 'forge-jenkins', + usernameVariable: 'DOCKER_REGISTRY_USERNAME', + passwordVariable: 'DOCKER_REGISTRY_PASSWORD' + ]) + ]) { + sh """ + echo '${env.DOCKER_REGISTRY_PASSWORD}' | docker login --username '${env.DOCKER_REGISTRY_USERNAME}' --password-stdin reg.cadoles.com + make docker-build docker-release + """ + } + } + } + } } post { diff --git a/misc/jenkins/Dockerfile b/misc/jenkins/Dockerfile index b520dfd..7ea0fc8 100644 --- a/misc/jenkins/Dockerfile +++ b/misc/jenkins/Dockerfile @@ -7,12 +7,22 @@ ARG https_proxy= # Install dev environment dependencies RUN export DEBIAN_FRONTEND=noninteractive &&\ + apt clean &&\ apt-get update -y &&\ - apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq + apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq gnupg # Add LetsEncrypt certificates RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash +RUN install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ + && chmod a+r /etc/apt/keyrings/docker.gpg \ + && echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" \ + | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && apt-get update \ + && apt-get install -y docker-ce-cli + ARG GO_VERSION=1.20.4 # Install Go