From d2c50a1353d1c22734b1171bdddd584162d0c258 Mon Sep 17 00:00:00 2001 From: ssube Date: Wed, 30 Oct 2019 18:53:44 -0500 Subject: [PATCH] fix(build): tag images with architecture --- .gitlab-ci.yml | 39 ++++++++++++++++++++++---------- Dockerfile => Dockerfile.stretch | 0 2 files changed, 27 insertions(+), 12 deletions(-) rename Dockerfile => Dockerfile.stretch (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48a45c4..7a8cf1e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,6 +36,7 @@ stages: allow_failure: false .build-docker: &build-docker + stage: image image: docker:18.09.9 services: - docker:18.09.9-dind @@ -50,11 +51,13 @@ stages: - echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json - docker info script: - - docker build -t $IMAGE_TAG . - - docker push $IMAGE_TAG + - docker build -f Dockerfile.${IMAGE_ARCH} -t ${IMAGE_TAG}-${IMAGE_ARCH} . + - docker push ${IMAGE_TAG}-${IMAGE_ARCH} after_script: - rm -rfv ${HOME}/.docker + dependencies: + - build-node variables: &vars-docker DOCKER_DRIVER: overlay2 DOCKER_HOST: tcp://localhost:2375 @@ -98,28 +101,40 @@ build-node: - node_modules - out/cache -build-image-branch: +.build-image-alpine-branch: <<: [*build-docker] - stage: image except: - tags - - dependencies: - - build-node variables: <<: [*vars-docker] + IMAGE_ARCH: alpine IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_REF_SLUG}" -build-image-tag: +.build-image-alpine-tag: <<: [*build-docker] - stage: image only: - tags - - dependencies: - - build-node variables: <<: [*vars-docker] + IMAGE_ARCH: alpine + IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_TAG}" + +build-image-stretch-branch: + <<: [*build-docker] + except: + - tags + variables: + <<: [*vars-docker] + IMAGE_ARCH: stretch + IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_REF_SLUG}" + +build-image-stretch-tag: + <<: [*build-docker] + only: + - tags + variables: + <<: [*vars-docker] + IMAGE_ARCH: stretch IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_TAG}" # publish jobs diff --git a/Dockerfile b/Dockerfile.stretch similarity index 100% rename from Dockerfile rename to Dockerfile.stretch