Debian Codegraph @

docker/scripts/build

raw
1 #!/bin/bash
2
3 script_directory="$( cd "$( dirname "$0" )" && pwd )"
4 project_directory=$script_directory/../..
5
6 # Specify the Docker image name
7 image_name='purpleidea/mgmt'
8
9 # Build the image which contains the compiled binary
10 docker build -t $image_name \
11 --file=$project_directory/docker/Dockerfile $project_directory
12
13 # Remove the container if it already exists
14 docker rm -f mgmt-export 2> /dev/null
15
16 # Start the container in background so we can "copy out" the binary
17 docker run -d --name=mgmt-export $image_name bash -c 'while true; sleep 1000; done'
18
19 # Remove the current binary
20 rm $project_directory/mgmt 2> /dev/null
21
22 # Get the binary from the container
23 docker cp mgmt-export:/go/src/mgmt/mgmt $project_directory/mgmt
24
25 # Remove the container
26 docker rm -f mgmt-export 2> /dev/null