Seed code for k8s multicloud plugin
[multicloud/k8s.git] / deployments / build.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Intel Corporation
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -o nounset
12 set -o pipefail
13 set -o xtrace
14
15 function generate_binary {
16     GOPATH=$(go env GOPATH)
17     rm -f k8plugin
18     rm -f *.so
19     $GOPATH/bin/dep ensure -v
20     for plugin in deployment namespace service; do
21         CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./$plugin.so ../src/k8splugin/plugins/$plugin/plugin.go
22     done
23     CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o ./k8plugin ../src/k8splugin/cmd/main.go
24 }
25
26 function build_image {
27     echo "Start build docker image."
28     docker-compose build --no-cache
29 }
30
31 generate_binary
32 build_image