image: docker:stable stages: - test - build services: - docker:dind variables: IMAGE_BASE: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY lint-dockerfiles: stage: test image: hadolint/hadolint:latest-alpine before_script: - '' script: - hadolint --failure-threshold error Dockerfile.* rules: - when: always test-pypi: stage: test script: - docker pull $IMAGE_BASE/pypi || true - docker build --cache-from $IMAGE_BASE/pypi --tag $IMAGE_BASE/pypi:$CI_COMMIT_SHA --tag $IMAGE_BASE/pypi:latest -f Dockerfile.pypi . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.pypi test-debian: stage: test script: - docker pull $IMAGE_BASE/debian || true - docker build --cache-from $IMAGE_BASE/debian --tag $IMAGE_BASE/debian:$CI_COMMIT_SHA --tag $IMAGE_BASE/debian:latest -f Dockerfile.debian . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.debian test-ubuntu: stage: test script: - docker pull $IMAGE_BASE/ubuntu || true - docker build --cache-from $IMAGE_BASE/ubuntu --tag $IMAGE_BASE/ubuntu:$CI_COMMIT_SHA --tag $IMAGE_BASE/ubuntu:latest -f Dockerfile.ubuntu . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.ubuntu test-fedora: stage: test script: - docker pull $IMAGE_BASE/fedora || true - docker build --cache-from $IMAGE_BASE/fedora --tag $IMAGE_BASE/fedora:$CI_COMMIT_SHA --tag $IMAGE_BASE/fedora:latest -f Dockerfile.fedora . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.fedora test-arch: stage: test script: - docker pull $IMAGE_BASE/arch || true - docker build --cache-from $IMAGE_BASE/arch --tag $IMAGE_BASE/arch:$CI_COMMIT_SHA --tag $IMAGE_BASE/arch:latest -f Dockerfile.arch . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.arch test-angular: stage: test script: - docker pull $IMAGE_BASE/angular || true - docker build --cache-from $IMAGE_BASE/angular --tag $IMAGE_BASE/angular:$CI_COMMIT_SHA --tag $IMAGE_BASE/angular:latest -f Dockerfile.angular . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.angular test-documentation: stage: test script: - docker pull $IMAGE_BASE/documentation || true - docker build --cache-from $IMAGE_BASE/documentation --tag $IMAGE_BASE/documentation:$CI_COMMIT_SHA --tag $IMAGE_BASE/documentation:latest -f Dockerfile.documentation . rules: - if: $CI_COMMIT_BRANCH != "master" changes: - Dockerfile.documentation build-pypi: stage: build script: - docker pull $IMAGE_BASE/pypi || true - docker build --cache-from $IMAGE_BASE/pypi --tag $IMAGE_BASE/pypi:$CI_COMMIT_SHA --tag $IMAGE_BASE/pypi:latest -f Dockerfile.pypi . - docker push $IMAGE_BASE/pypi:$CI_COMMIT_SHA - docker push $IMAGE_BASE/pypi:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.pypi build-debian: stage: build script: - docker pull $IMAGE_BASE/debian || true - docker build --cache-from $IMAGE_BASE/debian --tag $IMAGE_BASE/debian:$CI_COMMIT_SHA --tag $IMAGE_BASE/debian:latest -f Dockerfile.debian . - docker push $IMAGE_BASE/debian:$CI_COMMIT_SHA - docker push $IMAGE_BASE/debian:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.debian build-ubuntu: stage: build script: - docker pull $IMAGE_BASE/ubuntu || true - docker build --cache-from $IMAGE_BASE/ubuntu --tag $IMAGE_BASE/ubuntu:$CI_COMMIT_SHA --tag $IMAGE_BASE/ubuntu:latest -f Dockerfile.ubuntu . - docker push $IMAGE_BASE/ubuntu:$CI_COMMIT_SHA - docker push $IMAGE_BASE/ubuntu:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.ubuntu build-fedora: stage: build script: - docker pull $IMAGE_BASE/fedora || true - docker build --cache-from $IMAGE_BASE/fedora --tag $IMAGE_BASE/fedora:$CI_COMMIT_SHA --tag $IMAGE_BASE/fedora:latest -f Dockerfile.fedora . - docker push $IMAGE_BASE/fedora:$CI_COMMIT_SHA - docker push $IMAGE_BASE/fedora:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.fedora build-arch: stage: build script: - docker pull $IMAGE_BASE/arch || true - docker build --cache-from $IMAGE_BASE/arch --tag $IMAGE_BASE/arch:$CI_COMMIT_SHA --tag $IMAGE_BASE/arch:latest -f Dockerfile.arch . - docker push $IMAGE_BASE/arch:$CI_COMMIT_SHA - docker push $IMAGE_BASE/arch:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.arch build-angular: stage: build script: - docker pull $IMAGE_BASE/angular || true - docker build --cache-from $IMAGE_BASE/angular --tag $IMAGE_BASE/angular:$CI_COMMIT_SHA --tag $IMAGE_BASE/angular:latest -f Dockerfile.angular . - docker push $IMAGE_BASE/angular:$CI_COMMIT_SHA - docker push $IMAGE_BASE/angular:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.angular build-documentation: stage: build script: - docker pull $IMAGE_BASE/documentation || true - docker build --cache-from $IMAGE_BASE/documentation --tag $IMAGE_BASE/documentation:$CI_COMMIT_SHA --tag $IMAGE_BASE/documentation:latest -f Dockerfile.documentation . - docker push $IMAGE_BASE/documentation:$CI_COMMIT_SHA - docker push $IMAGE_BASE/documentation:latest rules: - if: $CI_COMMIT_BRANCH == "master" changes: - Dockerfile.documentation build-all: stage: build script: - | for NAME in debian ubuntu fedora arch angular documentation; do docker pull $IMAGE_BASE/$NAME || true docker build --cache-from $IMAGE_BASE/$NAME --tag $IMAGE_BASE/$NAME:$CI_COMMIT_SHA --tag $IMAGE_BASE/$NAME:latest -f Dockerfile.$NAME . docker push $IMAGE_BASE/$NAME:$CI_COMMIT_SHA docker push $IMAGE_BASE/$NAME:latest done rules: - when: manual