3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 ARG go_install_dir="/usr/local/go"
19 ARG DYNAMIC_LOCAL_PV_PROVISIONER_VERSION
20 ARG DEPENDENCY_MANAGER_VERSION
22 ENV PATH $go_install_dir/bin:$PATH
23 ENV BUILD_DIR="$GOPATH/src/github.com/nokia/dynamic-local-pv-provisioner"
27 && apk add --no-cache --virtual .build-deps build-base git mercurial go glide bash tar \
28 && apk add --no-cache curl e2fsprogs xfsprogs-extra \
29 && mkdir -p $go_install_dir \
30 && curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
31 && cd ${go_install_dir}/src/ \
33 && if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \
34 && curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/v${DEPENDENCY_MANAGER_VERSION}/dep-linux-${HOST_ARCH} \
35 && chmod +x /usr/local/bin/dep \
36 && mkdir -p $BUILD_DIR \
37 # && git clone https://github.com/balintTobik/dynamic-local-pv-provisioner.git $BUILD_DIR \
38 # && git clone https://github.com/nokia/dynamic-local-pv-provisioner.git $BUILD_DIR \
39 && git clone https://github.com/nokia/dynamic-local-pv-provisioner-fork.git $BUILD_DIR \
42 && git checkout ${DYNAMIC_LOCAL_PV_PROVISIONER_VERSION} \
44 && dep ensure --vendor-only \
45 && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o executor ./cmd/executor \
46 && mv $BUILD_DIR/executor /executor \
47 && CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o provisioner ./cmd/provisioner \
48 && mv $BUILD_DIR/provisioner /provisioner \
49 && apk del .build-deps \
51 && rm -rf $go_install_dir \
53 && rm -rf /root/.glide