From 382511f22a93871044e9e6e375faa3f7b8f6acd2 Mon Sep 17 00:00:00 2001
From: Parra <contacto@parravidales.es>
Date: Tue, 21 Dec 2021 12:40:58 +0100
Subject: [PATCH] Updated Dockerfile to support image versions

---
 Dockerfile  | 5 +++--
 Jenkinsfile | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index d5ab330..d4bf5f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
-FROM tomsquest/docker-radicale:latest
+ARG VERSION=latest
+FROM tomsquest/docker-radicale:$VERSION
 
-RUN python3 -m pip install git+https://github.com/Unrud/RadicaleInfCloud
+RUN python3 -m pip install --upgrade https://github.com/Unrud/RadicaleInfCloud/archive/master.tar.gz
 COPY config.js /usr/lib/python3.7/site-packages/radicale_infcloud/web/config.js
diff --git a/Jenkinsfile b/Jenkinsfile
index 29387f5..099e93a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,7 @@ pipeline {
         axes {
             axis {
                 name 'PLATFORM'
-                values 'linux/amd64', 'linux/386', 'linux/arm64', 'linux/arm/v7'
+                values 'linux/amd64', 'linux/386', 'linux/arm64', 'linux/arm'
             }
         }
         stages {
@@ -59,7 +59,7 @@ pipeline {
                   }
                   echo "Building ${TARGET_IMAGE} image..."
                   sh "docker pull ${SOURCE_IMAGE}"
-                  sh "docker buildx build -t ${TARGET_IMAGE} --platform ${PLATFORM} ."
+                  sh "docker buildx build -t ${TARGET_IMAGE} --platform ${PLATFORM} --build-arg VERSION=${PLATFORM.tokenize('/')[1]} ."
                 }
               }
             }
@@ -100,7 +100,7 @@ pipeline {
             VERSION = '.' + (env.BRANCH_NAME).tokenize('/')[1]
           }
           IMAGES = ''
-          for (ARCH in ['linux/amd64', 'linux/386', 'linux/arm64', 'linux/arm/v7']) {
+          for (ARCH in PLATFORM) {
             IMAGES += ' -a ' + TARGET + ':' + ARCH.tokenize('/')[1] + VERSION
           }
         }