--- include: - project: shore/ci-templates file: templates/pre-commit.yml - project: shore/ci-templates file: templates/notify.yml stages: - test - build - deploy # One day I may want to start tagging release and for that the TAG variable is # needed, but that would mean releasing ALL of the images when tagging (sort of # a periodic release). The images are not really related so for now TAG is # hard-coded to latest. variables: TAG: latest # Job templates: .build: stage: build variables: DOCKER_BUILDKIT: "1" tags: &tags [ns4.shore.co.il] script: - docker build --pull --no-cache --iidfile iid "$CONTEXT" after_script: - echo "HASH=$(cat iid)" > dot.env artifacts: reports: dotenv: dot.env rules: &rules - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_PIPELINE_SOURCE == "push" changes: - $CONTEXT/* - $CONTEXT/**/* .push: stage: deploy tags: *tags script: - docker tag "$HASH" "registry.shore.co.il/$IMAGE:${TAG:-latest}" - docker push "registry.shore.co.il/$IMAGE:${TAG:-latest}" rules: *rules # cgit image: build-cgit: extends: .build variables: CONTEXT: cgit push-cgit: extends: .push variables: CONTEXT: cgit IMAGE: cgit needs: - job: build-cgit artifacts: true # httpd latest image: build-httpd: extends: .build variables: CONTEXT: httpd/buster push-httpd: extends: .push variables: CONTEXT: httpd/buster IMAGE: httpd needs: - job: build-httpd artifacts: true # httpd buster image: push-httpd-buster: extends: .push variables: CONTEXT: httpd/buster IMAGE: httpd TAG: buster needs: - job: build-httpd artifacts: true # httpd bullseye image: build-httpd-bullseye: extends: .build variables: CONTEXT: httpd/bullseye push-httpd-bullseye: extends: .push variables: CONTEXT: httpd/bullseye IMAGE: httpd TAG: bullseye needs: - job: build-httpd-bullseye artifacts: true # sshd image: build-sshd: extends: .build variables: CONTEXT: sshd DOCKER_BUILDKIT: "" push-sshd: extends: .push variables: CONTEXT: sshd IMAGE: sshd needs: - job: build-sshd artifacts: true