2.1 KiB · text History 442a476
# Builds both deployment variants from a single source tree:
#
#   * standalone — site_encrypt provisions and renews ACME certs in-process.
#                  Suitable for VPS / bare-metal where the IRC node has direct
#                  access to ports 80/443.
#   * kubernetes — site_encrypt is compiled out; certs come from a mounted
#                  Secret (typically managed by cert-manager). Suitable for
#                  k8s deployments behind an ingress.
#
# Each variant produces its own image tag so deployments can pin to one
# explicitly.

.build:
  retry: 1
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:v1.23.2-debug
    entrypoint: [""]
  only:
    - master
  script:
    - |
      echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - |
      /kaniko/executor \
        --force \
        --context $CI_PROJECT_DIR \
        --dockerfile $CI_PROJECT_DIR/Dockerfile \
        --build-arg TLS_MODE=$TLS_MODE \
        --destination "$CI_REGISTRY_IMAGE:${TLS_MODE}-${CI_COMMIT_SHORT_SHA}" \
        --destination "$CI_REGISTRY_IMAGE:${TLS_MODE}-master" \
        --registry-mirror us0.regi.kube.gmp.io

build-standalone:
  extends: .build
  variables:
    TLS_MODE: standalone
  # Also publish standalone as `:latest` and `:master` since most VPS-style
  # deploys want the in-process ACME path.
  script:
    - |
      echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - |
      /kaniko/executor \
        --force \
        --context $CI_PROJECT_DIR \
        --dockerfile $CI_PROJECT_DIR/Dockerfile \
        --build-arg TLS_MODE=standalone \
        --destination "$CI_REGISTRY_IMAGE:standalone-${CI_COMMIT_SHORT_SHA}" \
        --destination "$CI_REGISTRY_IMAGE:standalone-master" \
        --destination "$CI_REGISTRY_IMAGE:master" \
        --destination "$CI_REGISTRY_IMAGE:latest" \
        --registry-mirror us0.regi.kube.gmp.io

build-kubernetes:
  extends: .build
  variables:
    TLS_MODE: kubernetes