Commit 6c9735fa authored by nimrod's avatar nimrod
Browse files

General Docker template.

- Merge the Docker CLI and Docker Compose templates.
parent 6c3d24c2
Loading
Loading
Loading
Loading

templates/docker-hub.yml

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
---
.hub-build:
  image: docker:19.03
  stage: build
  only:
    - branches
  variables:
    DOCKER_BUILDKIT: "1"
  before_script:
    - &tag |-
      if [ "$CI_COMMIT_BRANCH" = 'master' ]
      then
        TAG='latest'
      else
        TAG="$CI_COMMIT_BRANCH"
      fi
  script:
    - docker build -t "adarnimrod/$IMAGE:$TAG" ./

.hub-push:
  image: docker:19.03
  stage: deploy
  only:
    - branches
  before_script:
    - *tag
    - docker login --username adarnimrod --password "$DOCKER_HUB_TOKEN"
  script:
    - docker push "adarnimrod/$IMAGE:$TAG"

dummy:
  stage: .post
  script:
    - !!str true
  rules:
    - when: never
+29 −11
Original line number Diff line number Diff line
---
stages:
  - .pre
  - test
  - build
  - deploy
  - .post

include:
  - project: shore/ci-templates
    file: templates/pre-commit.yml

.compose-build:
  image: adarnimrod/ci-images:docker
  stage: build
@@ -45,6 +34,35 @@ include:
        done
        ! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'

.docker-build:
  image: docker:19.03
  stage: build
  only:
    - branches
  variables:
    DOCKER_BUILDKIT: "1"
  before_script:
    - &tag |-
      if [ "$CI_COMMIT_BRANCH" = 'master' ]
      then
        TAG='latest'
      else
        TAG="$CI_COMMIT_BRANCH"
      fi
  script:
    - docker build -t "adarnimrod/$IMAGE:$TAG" ./

.docker-push:
  image: docker:19.03
  stage: deploy
  only:
    - branches
  before_script:
    - *tag
    - docker login --username adarnimrod --password "$DOCKER_HUB_TOKEN"
  script:
    - docker push "adarnimrod/$IMAGE:$TAG"

dummy:
  stage: .post
  script: