infrastructure/.gitlab-ci.yml

72 lines
3 KiB
YAML

variables:
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:20.10.0-dind
.build: &build
image: docker:20.10.0
stage: build
script:
- docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}"
- docker build -f "${DOCKERFILE}" -t "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_SHA:0:8}" .
- docker tag "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_SHA:0:8}" "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG}"
- docker push "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_SHA:0:8}"
- docker push "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG}"
- if [[ "${CI_COMMIT_REF_SLUG}" == "main" ]]; then docker tag "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG}" "${CI_REGISTRY_IMAGE}/${NAME}:latest" && docker push "${CI_REGISTRY_IMAGE}/${NAME}:latest"; fi
signal-server:
image: docker:20.10.0
stage: build
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker build -f signal-server.Dockerfile -t ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} .
- export VERSION=$(docker run ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} java -jar /usr/share/TextSecureServer.jar -v)
- docker tag ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_REF_SLUG}
- docker tag ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} ${CI_REGISTRY_IMAGE}/signal-server:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8}
- docker push ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_REF_SLUG}
- docker push ${CI_REGISTRY_IMAGE}/signal-server:${VERSION}
- echo "docker pull ${CI_REGISTRY_IMAGE}/signal-server:${VERSION}"
allow_failure: true
freebsd-cross-build:
image: docker:20.10.0
stage: build
script:
- apk add git
- git clone https://github.com/wezm/freebsd-cross-build.git
- cd freebsd-cross-build
- VERSION=$(git rev-parse --short=8 HEAD)
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker build -t ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:${VERSION} .
- docker push ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:${VERSION}
- if [[ "${CI_COMMIT_REF_SLUG}" == "main" ]]; then docker tag ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:${VERSION} ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:latest && docker push ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:latest; fi
- echo "docker pull ${CI_REGISTRY_IMAGE}/${CI_JOB_NAME}:${VERSION}"
test-helper:
<<: *build
variables:
DOCKERFILE: "test-helper.Dockerfile"
NAME: "test-helper"
allow_failure: true
builder-image:x86:
<<: *build
variables:
DOCKERFILE: "signald-builder.Dockerfile"
NAME: "signald-builder-x86"
builder-image:aarch64:
<<: *build
tags: [arm-docker-builder]
variables:
DOCKERFILE: "signald-builder.Dockerfile"
NAME: "signald-builder-arm"
builder-image-alpine:aarch64:
<<: *build
tags: [arm-docker-builder]
variables:
DOCKERFILE: "signald-builder-alpine.Dockerfile"
NAME: "signald-builder-alpine-arm"