summaryrefslogtreecommitdiff
path: root/packages/vyos-build-container/build.sh
blob: af5ae34c416f545b75298ee3ec64051eb1702ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
set -e

cd vyos-build/docker

echo "Cleaning previous image of ${BRANCH_NAME}..."
docker rmi --force "vyos/vyos-build:${BRANCH_NAME}" || true
docker rmi --force "${CUSTOM_DOCKER_REPO}/vyos/vyos-build:$BRANCH_NAME" || true

echo "Building docker build container for branch ${BRANCH_NAME}..."
docker build . -t "vyos/vyos-build:${BRANCH_NAME}"

echo "Pushing ${BRANCH_NAME} image to registry ${CUSTOM_DOCKER_REPO}..."
docker tag "vyos/vyos-build:${BRANCH_NAME}" "${CUSTOM_DOCKER_REPO}/vyos/vyos-build:${BRANCH_NAME}"
docker push "${CUSTOM_DOCKER_REPO}/vyos/vyos-build:$BRANCH_NAME"

echo "Image ${BRANCH_NAME} was successfully built and pushed to registry ${CUSTOM_DOCKER_REPO}."