Dactyloidae/security/nss/automation/taskcluster/scripts/build_image.sh

27 lines
791 B
Bash
Raw Normal View History

2018-02-23 11:04:39 +01:00
#!/bin/bash -vex
set -x -e -v
# Prefix errors with taskcluster error prefix so that they are parsed by Treeherder
raise_error() {
echo
echo "[taskcluster-image-build:error] $1"
exit 1
}
# Ensure that the PROJECT is specified so the image can be indexed
test -n "$PROJECT" || raise_error "Project must be provided."
test -n "$HASH" || raise_error "Context Hash must be provided."
2018-12-15 01:42:53 +01:00
CONTEXT_PATH="/home/worker/nss/$CONTEXT_PATH"
2018-02-23 11:04:39 +01:00
2018-12-15 01:42:53 +01:00
test -d "$CONTEXT_PATH" || raise_error "Context Path $CONTEXT_PATH does not exist."
2018-02-23 11:04:39 +01:00
test -f "$CONTEXT_PATH/Dockerfile" || raise_error "Dockerfile must be present in $CONTEXT_PATH."
2026-06-29 21:29:25 +01:00
apt-get update
apt-get -y install zstd
2018-12-15 01:42:53 +01:00
docker build -t "$PROJECT:$HASH" "$CONTEXT_PATH"
2018-02-23 11:04:39 +01:00
mkdir /artifacts
2026-06-29 21:29:25 +01:00
docker save "$PROJECT:$HASH" | zstd > /artifacts/image.tar.zst