From eae74c029ad5e70328602a07c3028feeee9fb813 Mon Sep 17 00:00:00 2001 From: Vikram Yadav Date: Fri, 3 Feb 2017 16:23:41 -0500 Subject: [PATCH] Added Dockerfile for licensefinder/license_finder - Moved files to more consistent with concourse structure [Finish #138061177] Signed-off-by: Ryan Collins --- Dockerfile | 82 +++++++++++++++++++++++++++++ ci/install_bower.sh | 5 -- ci/install_godep.sh | 6 --- ci/install_gradle.sh | 12 ----- ci/install_rebar.sh | 14 ----- ci/{ => pipelines}/pipeline.yml.erb | 2 +- ci/{ => scripts}/test.sh | 14 ++--- build.yml => ci/tasks/build.yml | 6 +-- 8 files changed, 90 insertions(+), 51 deletions(-) create mode 100644 Dockerfile delete mode 100755 ci/install_bower.sh delete mode 100755 ci/install_godep.sh delete mode 100755 ci/install_gradle.sh delete mode 100755 ci/install_rebar.sh rename ci/{ => pipelines}/pipeline.yml.erb (90%) rename ci/{ => scripts}/test.sh (56%) rename build.yml => ci/tasks/build.yml (54%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..44727683e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,82 @@ +FROM ubuntu:trusty +RUN apt-get update && apt-get install -y curl git-core + +#install rvm +RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 && \ + curl -sSL https://get.rvm.io | bash -s stable --ruby +ENV PATH=/usr/local/rvm/bin:$PATH + +# install build-essential wget unzip +RUN apt-get install -y build-essential wget unzip + +# nodejs seems to be required for the one of the gems +RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ + apt-get -y install nodejs + +# install bower +RUN npm install -g bower && \ + echo '{ "allow_root": true }' > /root/.bowerrc + +# install bundler +RUN bash -lc "rvm install 2.3.3 && rvm use 2.3.3 && gem install bundler" + +#install java 8 +#http://askubuntu.com/questions/521145/how-to-install-oracle-java-on-ubuntu-14-04 +RUN cd /tmp && \ + wget --quiet --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.tar.gz -O jdk-8.tgz && \ + tar xf /tmp/jdk-8.tgz && \ + mkdir -p /usr/lib/jvm && \ + mv jdk1.8.0_66 /usr/lib/jvm/oracle_jdk8 && \ + rm /tmp/jdk-8.tgz + +ENV J2SDKDIR=/usr/lib/jvm/oracle_jdk8 +ENV J2REDIR=/usr/lib/jvm/oracle_jdk8/jre +ENV PATH=$PATH:/usr/lib/jvm/oracle_jdk8/bin:/usr/lib/jvm/oracle_jdk8/db/bin:/usr/lib/jvm/oracle_jdk8/jre/bin +ENV JAVA_HOME=/usr/lib/jvm/oracle_jdk8 +ENV DERBY_HOME=/usr/lib/jvm/oracle_jdk8/db + +RUN java -version + +# install python and rebar +RUN apt-get install -y python rebar + +# install and update python-pip +RUN apt-get install -y python-pip && \ + pip install --upgrade pip + +# install maven +RUN curl -O http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz && \ + tar -xf apache-maven-3.3.9-bin.tar.gz; rm -rf apache-maven-3.3.9-bin.tar.gz && \ + mv apache-maven-3.3.9 /usr/local/lib/maven && \ + ln -s /usr/local/lib/maven/bin/mvn /usr/local/bin/mvn + +# install gradle +WORKDIR /tmp +RUN curl -L -o gradle.zip http://services.gradle.org/distributions/gradle-2.4-bin.zip && \ + unzip -q gradle.zip && \ + rm gradle.zip && \ + mv gradle-2.4 /root/gradle +ENV PATH=/root/gradle/bin:$PATH + +#install go +WORKDIR /go +RUN wget https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz -O go.tar.gz && tar --strip-components=1 -xf go.tar.gz +ENV GOROOT /go +ENV PATH=$PATH:/go/bin + +# godep is now required for license_finder to work for project that are still managed with GoDep +ENV GOROOT=/go +ENV GOPATH=/gopath +ENV PATH=$PATH:$GOPATH/bin +RUN mkdir /gopath && go get github.com/tools/godep + +# Fix the locale +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +# install license_finder +RUN bash -lc "git clone https://github.com/pivotal/LicenseFinder /LicenseFinder && cd /LicenseFinder && bundle install -j4 && rake install" + +WORKDIR / \ No newline at end of file diff --git a/ci/install_bower.sh b/ci/install_bower.sh deleted file mode 100755 index caef749ce..000000000 --- a/ci/install_bower.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e -set -x - -npm install -g bower diff --git a/ci/install_godep.sh b/ci/install_godep.sh deleted file mode 100755 index 6605b6c46..000000000 --- a/ci/install_godep.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e -set -x - -mkdir -p ~/go -go get github.com/tools/godep diff --git a/ci/install_gradle.sh b/ci/install_gradle.sh deleted file mode 100755 index 32dd04768..000000000 --- a/ci/install_gradle.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e -set -x - -pushd /tmp - -curl -L -o gradle.zip http://services.gradle.org/distributions/gradle-2.4-bin.zip -unzip -q gradle.zip -rm gradle.zip -mv gradle* ~/gradle - -popd diff --git a/ci/install_rebar.sh b/ci/install_rebar.sh deleted file mode 100755 index 1ea185f72..000000000 --- a/ci/install_rebar.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -e -set -x - -pushd ~ - -git clone --depth 1 git://github.com/rebar/rebar.git -cd rebar -./bootstrap - -erl -version -PATH=$HOME/rebar:$PATH rebar --version - -popd diff --git a/ci/pipeline.yml.erb b/ci/pipelines/pipeline.yml.erb similarity index 90% rename from ci/pipeline.yml.erb rename to ci/pipelines/pipeline.yml.erb index 40f9fc420..b5cc13862 100644 --- a/ci/pipeline.yml.erb +++ b/ci/pipelines/pipeline.yml.erb @@ -14,7 +14,7 @@ jobs: - get: LicenseFinder trigger: true - task: ruby-<%= ruby_version %> - file: LicenseFinder/build.yml + file: LicenseFinder/ci/tasks/build.yml params: RUBY_VERSION: <%= ruby_version %> <% end %> \ No newline at end of file diff --git a/ci/test.sh b/ci/scripts/test.sh similarity index 56% rename from ci/test.sh rename to ci/scripts/test.sh index cbe4a56d9..50c2a4308 100755 --- a/ci/test.sh +++ b/ci/scripts/test.sh @@ -1,19 +1,13 @@ -#!/bin/bash +#!/bin/bash --login set -e -x pushd LicenseFinder - source /root/.bash_profile - - rbenv global $RUBY_VERSION + rvm install $RUBY_VERSION + rvm use $RUBY_VERSION ruby --version - chmod +x ci/install_*.sh - ./ci/install_rebar.sh - ./ci/install_bower.sh - ./ci/install_gradle.sh - ./ci/install_godep.sh - export PATH=$PATH:$HOME/gradle/bin:$HOME/rebar:$HOME/go/bin GOPATH=$HOME/go + export GOPATH=$HOME/go export RUBYOPT='-E utf-8' gem update --system diff --git a/build.yml b/ci/tasks/build.yml similarity index 54% rename from build.yml rename to ci/tasks/build.yml index 0df48fcd7..aa1447dec 100644 --- a/build.yml +++ b/ci/tasks/build.yml @@ -3,14 +3,14 @@ platform: linux image_resource: type: docker-image source: - repository: ddubson/rb-go-java-node-erl-py - tag: v2 + repository: licensefinder/license_finder + tag: latest inputs: - name: LicenseFinder run: - path: ./LicenseFinder/ci/test.sh + path: ./LicenseFinder/ci/scripts/test.sh params: RUBY_VERSION: