James Gibson 01f8569011 Move COPY in Dockerfile and add build script.
COPY in the Dockerfile has been moved so that changes to the source code
do not cause an apt update unnecessarily.
A build script has aslo been added to build and extract the build artefacts.
This build script is usedby Ansible to deploy the application to compute hosts.

Change-Id: I66d2b671d991d1ce3bef544532b058d33f32d282

Create build script which exports the build artefacts

Change-Id: Ifa1458a6b17484d378ec14b4cba2e0493b722f7b

Make build script fail if any of the stages fail

Change-Id: I325cf2d44f40f19a198bc03858625add20e10494
2020-05-29 10:57:41 +01:00

15 lines
394 B
Bash
Executable File

#!/bin/bash
# Small script to build libvirtd-exporter using docker and export the resulting binary
set -e
docker build -t libvirtd-exporter .
# Start container with result
docker run --entrypoint sh -itd --name libvirtd-exporter libvirtd-exporter
# Extract build atifact to host
docker cp libvirtd-exporter:/libvirtd_exporter .
docker stop libvirtd-exporter
docker rm -f libvirtd-exporter