infrastructure/.gitlab-ci.yml

92 lines
4.3 KiB
YAML
Raw Permalink Normal View History

2020-12-14 19:34:40 +00:00
variables:
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_DRIVER: overlay2
2020-12-14 19:34:40 +00:00
services:
- docker:dind
2020-12-14 19:34:40 +00:00
2020-12-02 11:00:46 +00:00
.build: &build
image: docker:latest
2020-12-02 11:00:46 +00:00
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}"
2020-12-02 20:10:40 +00:00
- 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
2020-12-02 11:00:46 +00:00
.docker-multiarch-image: &docker-multiarch-image
image: jdrouet/docker-with-buildx:stable
stage: build
tags: [docker-builder]
before_script: # per recommendations from https://github.com/docker/buildx/issues/495#issuecomment-754200673
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker buildx create --name cibuilder --driver docker-container --use
- docker buildx inspect --bootstrap
- docker login -u gitlab-ci-token -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}"
- export platform_sanatized=$(echo ${PLATFORM:6} | sed 's#/#-#g')
script:
2021-07-24 06:01:50 +00:00
- docker buildx build --platform "${PLATFORM}" -f "${DOCKERFILE}" -t "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_SHA:0:8}" -t "${CI_REGISTRY_IMAGE}/${NAME}-${platform_sanatized}:${CI_COMMIT_SHA:0:8}" -t "${CI_REGISTRY_IMAGE}/${NAME}:${CI_COMMIT_REF_SLUG}" -t "${CI_REGISTRY_IMAGE}/${NAME}-${platform_sanatized}:${CI_COMMIT_REF_SLUG}" --push .
2021-07-24 06:00:27 +00:00
- if [[ "${CI_COMMIT_REF_SLUG}" == "main" ]]; then docker buildx build --platform "${PLATFORM}" -f "${DOCKERFILE}" -t "${CI_REGISTRY_IMAGE}/${NAME}:latest" -t "${CI_REGISTRY_IMAGE}/${NAME}-${platform_sanatized}:latest" --push . ; fi
parallel:
matrix:
- PLATFORM:
- linux/amd64
- linux/arm64/v8
- linux/arm/v7
2020-12-02 11:00:46 +00:00
signal-server:
2020-12-14 19:34:40 +00:00
image: docker:20.10.0
2018-12-01 23:23:22 +00:00
stage: build
script:
2019-10-17 04:37:27 +00:00
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
2018-12-02 00:03:18 +00:00
- docker build -f signal-server.Dockerfile -t ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} .
2019-10-17 04:33:35 +00:00
- export VERSION=$(docker run ${CI_REGISTRY_IMAGE}/signal-server:${CI_COMMIT_SHA:0:8} java -jar /usr/share/TextSecureServer.jar -v)
2018-12-01 23:23:22 +00:00
- 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}
2018-12-03 17:34:46 +00:00
- echo "docker pull ${CI_REGISTRY_IMAGE}/signal-server:${VERSION}"
2020-12-02 23:52:26 +00:00
allow_failure: true
2021-02-19 21:51:47 +00:00
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
- echo "RUN apt-get update && apt-get install -y git" >> Dockerfile
2021-02-19 21:51:47 +00:00
- 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}"
2020-12-14 19:34:40 +00:00
test-helper:
2020-12-02 11:00:46 +00:00
<<: *build
variables:
2020-12-14 19:34:40 +00:00
DOCKERFILE: "test-helper.Dockerfile"
NAME: "test-helper"
2020-12-02 23:52:26 +00:00
allow_failure: true
2020-12-02 11:00:46 +00:00
signal-cross-builder:
2020-12-02 11:00:46 +00:00
<<: *build
variables:
DOCKERFILE: "signald-cross-builder.Dockerfile"
NAME: "signald-cross-builder"
2020-12-02 23:28:26 +00:00
builder-image-alpine:
<<: *docker-multiarch-image
2020-12-02 23:28:26 +00:00
variables:
DOCKERFILE: "signald-builder-alpine.Dockerfile"
NAME: "signald-builder-alpine-arm"
signald-builder:
<<: *docker-multiarch-image
variables:
DOCKERFILE: "signald-builder.Dockerfile"
NAME: "signald-builder"