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

# Base image templates:
stages:
  - build-base
  - deploy-base
  - build
  - deploy

.container-build-base:
  extends: .container-build
  stage: build-base

.container-push-base:
  extends: .container-push
  stage: deploy-base

# cgit image:

build-cgit:
  extends: .container-build
  variables:
    CONTEXT: cgit

push-cgit:
  extends: .container-push
  variables:
    CONTEXT: cgit
    IMAGE: cgit
  needs:
    - job: build-cgit
      artifacts: true

# httpd latest image:

build-httpd:
  extends: .container-build-base
  variables:
    CONTEXT: httpd/bullseye

push-httpd:
  extends: .container-push-base
  variables:
    CONTEXT: httpd/bullseye
    IMAGE: httpd
  needs:
    - job: build-httpd
      artifacts: true

# httpd bullseye image:

push-httpd-bullseye:
  extends: .container-push-base
  variables:
    CONTEXT: httpd/bullseye
    IMAGE: httpd
    TAG: bullseye
  needs:
    - job: build-httpd
      artifacts: true

# httpd buster image:

build-httpd-buster:
  extends: .container-build-base
  variables:
    CONTEXT: httpd/buster

push-httpd-buster:
  extends: .container-push
  variables:
    CONTEXT: httpd/buster
    IMAGE: httpd
    TAG: buster
  needs:
    - job: build-httpd-buster
      artifacts: true

# sshd image:

build-sshd:
  extends: .container-build
  variables:
    CONTEXT: sshd
    DOCKER_BUILDKIT: ""

push-sshd:
  extends: .container-push
  variables:
    CONTEXT: sshd
    IMAGE: sshd
  needs:
    - job: build-sshd
      artifacts: true

# crond image:

build-crond:
  extends: .container-build-base
  variables:
    CONTEXT: crond

push-crond:
  extends: .container-push-base
  variables:
    CONTEXT: crond
    IMAGE: cron
  needs:
    - job: build-crond
      artifacts: true

# sleep image:

build-sleep:
  extends: .container-build
  variables:
    CONTEXT: sleep

push-sleep:
  extends: .container-push
  variables:
    CONTEXT: sleep
    IMAGE: sleep
  needs:
    - job: build-sleep
      artifacts: true

# webdav image:

build-webdav:
  extends: .container-build
  variables:
    CONTEXT: webdav

push-webdav:
  extends: .container-push
  variables:
    CONTEXT: webdav
    IMAGE: webdav
  needs:
    - job: build-webdav
      artifacts: true

# nginx image:

build-nginx:
  extends: .container-build-base
  variables:
    CONTEXT: nginx

push-nginx:
  extends: .container-push-base
  variables:
    CONTEXT: nginx
    IMAGE: nginx
  needs:
    - job: build-nginx
      artifacts: true
