From ff4c42dc245a3d1b08dc3fca6cd727de81b54dcc Mon Sep 17 00:00:00 2001 From: Mohamed Sohail Date: Wed, 5 Jan 2022 08:11:38 +0000 Subject: [PATCH] feat (devops): add local image build for releases --- docker-compose.build.yml | 52 +++++++++++++++++++++++++++++++++++++ scripts/local-build-push.sh | 23 ++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 docker-compose.build.yml create mode 100644 scripts/local-build-push.sh diff --git a/docker-compose.build.yml b/docker-compose.build.yml new file mode 100644 index 00000000..11e77fdc --- /dev/null +++ b/docker-compose.build.yml @@ -0,0 +1,52 @@ +version: '3.2' + +services: + cic-cache: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-cache:${TAG:-latest} + build: + context: apps/cic-cache + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-cache:latest + cic-eth: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:${TAG:-latest} + build: + context: apps/cic-eth + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:latest + cic-meta: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-meta:${TAG:-latest} + build: + context: apps/cic-meta + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-meta:latest + cic-notify: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-notify:${TAG:-latest} + build: + context: apps/cic-notify + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-notify:latest + funga-eth: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/funga-eth:${TAG:-latest} + build: + context: apps/cic-signer + dockerfile: Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/funga-eth:latest + cic-ussd: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-ussd:${TAG:-latest} + build: + context: apps/cic-ussd + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-ussd:latest + cic-contract-bootstrap: + image: ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-contract-bootstrap:${TAG:-latest} + build: + context: apps/contract-migration + dockerfile: docker/Dockerfile + cache_from: + - ${IMAGE_BASE_URL:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-ussd:latest \ No newline at end of file diff --git a/scripts/local-build-push.sh b/scripts/local-build-push.sh new file mode 100644 index 00000000..967733e5 --- /dev/null +++ b/scripts/local-build-push.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh + +# dependencies: +# - docker-compose >= v1.25.0 +# - sbot >= v1.0.0. + +set -e + +export DOCKER_BUILDKIT=1 +export COMPOSE_DOCKER_CLI_BUILD=1 + +PREDICTED_TAG=$(sbot predict version -m auto) + +docker-compose -f docker-compose.build.yml build --progress plain + +export TAG=v$PREDICTED_TAG + +docker-compose -f docker-compose.build.yml build --progress plain +docker-compose -f docker-compose.build.yml push + +export TAG=latest + +docker-compose -f docker-compose.build.yml push