image: docker:stable

variables:
  BUILDER_TAG: index.docker.io/algorithmiahq/dev-center:latest
  IMAGE_TAG: index.docker.io/algorithmiahq/dev-center:$CI_COMMIT_SHA
  GIT_SUBMODULE_STRATEGY: recursive

services:
  - docker:19.03.4

stages:
  - build
  - push

#
# Build
#

build:
  stage: build
  image:
    name: docker:stable
    entrypoint: [""]
  before_script:
    - mkdir ~/.docker
    - echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
    - docker pull $BUILDER_TAG || true
  script:
    - docker build
      -t $BUILDER_TAG
      -t $IMAGE_TAG
      --file $CI_PROJECT_DIR/Dockerfile
      --cache-from $BUILDER_TAG
      $CI_PROJECT_DIR
    - docker push $BUILDER_TAG
    - mkdir image
    - docker save $IMAGE_TAG > image/golduck.tar
  artifacts:
    paths:
      - image

#
# Push
#

push:
  stage: push
  image:
    name: docker:stable
    entrypoint: [""]
  before_script:
    - mkdir ~/.docker
    - echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
  script:
    - docker load -i image/golduck.tar
    - docker push $IMAGE_TAG
  only:
    - /^(master|develop)$/
  except:
    - tags


image: docker:stable

variables:
  BUILDER_TAG: index.docker.io/algorithmiahq/dev-center:latest
  IMAGE_TAG: index.docker.io/algorithmiahq/dev-center:$CI_COMMIT_SHA
  GIT_SUBMODULE_STRATEGY: recursive

services:
  - docker:18.09.7

stages:
  - build
  - push

#
# Build
#

build:
  stage: build
  image:
    name: docker:stable
    entrypoint: [""]
  before_script:
    - mkdir ~/.docker
    - echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
    - docker pull $BUILDER_TAG || true
  script:
    - docker build
      -t $BUILDER_TAG
      -t $IMAGE_TAG
      --file $CI_PROJECT_DIR/Dockerfile
      --cache-from $BUILDER_TAG
      $CI_PROJECT_DIR
    - docker push $BUILDER_TAG
    - mkdir image
    - docker save $IMAGE_TAG > image/golduck.tar
  artifacts:
    paths:
      - image

#
# Push
#

push:
  stage: push
  image:
    name: docker:stable
    entrypoint: [""]
  before_script:
    - mkdir ~/.docker
    - echo "$DOCKER_AUTH_CONFIG" > ~/.docker/config.json
  script:
    - docker load -i image/golduck.tar
    - docker push $IMAGE_TAG
  only:
    - /^(master|develop)$/
  except:
    - tags


Revert to previous docker version.
Revert to previous docker version.
