.gitlab-ci.yml 796 Bytes
Newer Older
David Blyth's avatar
David Blyth committed
1
before_script:
2 3 4 5
    - docker info

stages:
    - build
6
    - build-cleanup
David Blyth's avatar
David Blyth committed
7
    - deploy
8
    - cleanup
David Blyth's avatar
David Blyth committed
9

10
build-image:
11 12
    stage: build
    script:
13
        - bash -c 'if [ "$(docker images -f reference=argonneeic/base:$CI_COMMIT_SHA --format {{.Tag}})" == "" ]; then docker build -t argonneeic/base:$CI_COMMIT_SHA --build-arg BUILD_THREADS=20 .; fi'
David Blyth's avatar
David Blyth committed
14

15 16
cleanup-containers:
    stage: build-cleanup
17
    script:
18 19
        - bash -c 'docker rm $(docker ps -qa --no-trunc --filter "status=exited") || :'
    when: on_failure
20

21
deploy-to-dockerhub:
David Blyth's avatar
David Blyth committed
22 23
    stage: deploy
    script:
24 25
        - bash -c 'docker rmi argonneeic/base:latest || :'
        - docker tag argonneeic/base:$CI_COMMIT_SHA argonneeic/base
David Blyth's avatar
David Blyth committed
26
        - bash deploy.sh
27
        - docker rmi argonneeic/base:$CI_COMMIT_SHA
David Blyth's avatar
David Blyth committed
28 29
    only:
        - master