David K. Bainbridge | bba65ff | 2018-01-19 09:26:09 -0800 | [diff] [blame] | 1 | # Copyright 2018 the original author or authors. |
| 2 | # |
| 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 |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 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. |
| 14 | |
Sergio Slobodrian | 6f5fc4c | 2017-11-17 15:31:12 -0500 | [diff] [blame] | 15 | FROM golang:1.9.2 |
Kim Kempf | 01e23a8 | 2018-02-09 14:23:50 -0800 | [diff] [blame] | 16 | MAINTAINER Voltha Community <info@opennetworking.org> |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 17 | |
Gertjan Van Droogenbroeck | e0c9acb | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 18 | RUN apt-get update && apt-get install -y apt-transport-https ca-certificates jq curl gnupg2 software-properties-common |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 19 | |
Gertjan Van Droogenbroeck | e0c9acb | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 20 | RUN curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - |
| 21 | RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 22 | |
Gertjan Van Droogenbroeck | e0c9acb | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 23 | RUN apt-get update && apt-cache policy docker-ce && apt-get install -y upx-ucl docker-ce && apt-get clean |
Sergio Slobodrian | be82927 | 2017-07-17 14:45:45 -0400 | [diff] [blame] | 24 | |
| 25 | RUN go get github.com/pwaller/goupx \ |
| 26 | && go get golang.org/x/tools/cmd/cover \ |
| 27 | && go get -u github.com/golang/lint/golint \ |
| 28 | && go get github.com/kisielk/errcheck \ |
| 29 | && go get github.com/cespare/prettybench \ |
| 30 | && go get github.com/uber/go-torch |
| 31 | |
| 32 | # Install dependency management tools |
| 33 | # gpm |
| 34 | RUN wget https://raw.githubusercontent.com/pote/gpm/v1.3.2/bin/gpm -O /usr/local/bin/gpm && \ |
| 35 | chmod +x /usr/local/bin/gpm |
| 36 | |
| 37 | # glide |
| 38 | ENV glide_version=v0.12.3 |
| 39 | RUN mkdir -p bin ; \ |
| 40 | curl -L https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-amd64.tar.gz | \ |
| 41 | tar -xz -C bin ; \ |
| 42 | mv bin/linux-amd64/glide bin/glide; \ |
| 43 | rm -rf bin/linux-amd64 |
| 44 | |
| 45 | |
| 46 | ARG GITHUB_TOKEN |
| 47 | RUN echo "machine github.com login $GITHUB_TOKEN" >/root/.netrc |
| 48 | |
| 49 | COPY build_environment.sh / |
| 50 | COPY build.sh / |
| 51 | |
| 52 | VOLUME /src |
| 53 | WORKDIR /src |
| 54 | |
| 55 | ENV GORACE="halt_on_error=1" |
| 56 | |
| 57 | ENTRYPOINT ["/build.sh"] |