Files
speckle-server/.circleci/build.sh
T
Iain Sproat a51ba5f4a9 Circleci manual holds (#1152)
* ci(circleci): introduces manual holds to prevent resource wastage

We were building all commits unnecessarily. The logic was not consistent for versioning and when to
build and when to publish. This PR addresses these issues.

* Replaces `should-build` with `build-approval`
* Replace `should-publish` with `publish-approval`

* Clean up image tagging logic
    - tags as latest when version is semver or semver-alpha.build_number
    - other commits aren't tagged as latest, and instead tagged with their branch name
    - move naming logic to common.sh script

* Push each tag individually to avoid pollution
    - docker engine used is shared amongst all runs of speckle-server pipeline, so pushing all tags indiscrimanately pushes images built on other CircleCI runs 😬

* Improve logging
* Do not require approval for any tagged commit
2022-11-01 08:52:51 +00:00

20 lines
760 B
Bash
Executable File

#!/bin/bash
set -eo pipefail
# enables building the test-deployment container with the same script
# defaults to packages for minimal intervention in the ci config
FOLDER="${FOLDER:-packages}"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# shellcheck disable=SC1090,SC1091
source "${SCRIPT_DIR}/common.sh"
echo "Building image: ${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}"
export DOCKER_BUILDKIT=1
docker build --build-arg SPECKLE_SERVER_VERSION="${IMAGE_VERSION_TAG}" --tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" --file "${FOLDER}/${SPECKLE_SERVER_PACKAGE}/Dockerfile" .
echo " Saving image: ${DOCKER_FILE_NAME}"
docker save --output "/tmp/ci/workspace/${DOCKER_FILE_NAME}" "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}"