Hello! We are running our annual fundraising. Please consider making a donation if you value this freely available service or want to support people around the world working towards liberatory social change. https://riseup.net/donate.

Verified Commit d944721a authored by Varac's avatar Varac
Browse files

Build docker images from CI

parent 64e961fe
Pipeline #5274 passed with stages
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
---
stages:
- docker_image_sdk
- docker_image_other
- build
before_script:
- git submodule sync --recursive
- git submodule update --init --recursive
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
DOCKER_DRIVER: overlay
.job_template: &build_docker_image
image: 0xacab.org:4567/leap/docker/debian:stretch_amd64
tags:
- docker-in-docker
services:
- docker:dind
script:
- docker --version
- docker info
- >
export LAST_COMMIT=$(curl -s --header "PRIVATE-TOKEN: ${LEAP_CODE_O_MATIC_PRIVATE_TOKEN}" https://0xacab.org/api/v4/projects/578/pipelines |
python -c "import sys, json; print json.load(sys.stdin)[1]['sha']")
- .gitlab/build.sh ${DOCKER_IMAGE}
docker_image:sdk:
stage: docker_image_sdk
variables:
DOCKER_IMAGE: android-sdk
<<: *build_docker_image
docker_image:ndk:
stage: docker_image_other
variables:
DOCKER_IMAGE: android-ndk
<<: *build_docker_image
docker_image:emulator:
stage: docker_image_other
variables:
DOCKER_IMAGE: android-emulator
<<: *build_docker_image
build:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- git submodule sync --recursive
- git submodule update --init --recursive
- ./gradlew assembleDebug
artifacts:
paths:
......
#!/bin/bash
#
# Build script for the gitlab ci.
#
# usage: build.sh DIR [TAG]
#
# Will run docker build in DIR with DIR/Dockerfile or
# DIR/TAG.dockerfile if TAG is given.
#
# Assumes CI specific environment variables to be set:
# CI_REGISTRY_IMAGE
# LAST_COMMIT (fetched from the gitlab api in before_script hook)
#
DIR=$1
TAG=${2:-latest}
DOCKERFILE=docker/${DIR}/${2:-Dockerfile}${2:+.dockerfile}
TARGET=${CI_REGISTRY_IMAGE}/${DIR}:${TAG}
if git diff "$LAST_COMMIT" HEAD --name-only | egrep "($DOCKERFILE|^.gitlab)"; then
docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
docker build -t "$TARGET" -f "$DOCKERFILE" docker/
docker push "$TARGET"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment