Skip to content

Commit

Permalink
tidy up proxy setup scripts into one file and update Java to v8.0.202
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr.Snowbird authored and Dr.Snowbird committed Feb 13, 2019
1 parent 2e8474c commit 2e70db1
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 120 deletions.
15 changes: 0 additions & 15 deletions .env

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
data/
.fuse*
*.zip*

*.log
npm-debug.log*
node_modules
.env
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ COPY ./script ${SCRIPT_DIR}
RUN chmod +x ${SCRIPT_DIR}/*.sh

#### ---- Apt Proxy & NPM Proxy & NPM Permission setup if detected: ---- ####
RUN cd ${SCRIPT_DIR}; ${SCRIPT_DIR}/setup_apt_proxy.sh
RUN cd ${SCRIPT_DIR}; ${SCRIPT_DIR}/setup_npm_proxy.sh
RUN cd ${SCRIPT_DIR}; ${SCRIPT_DIR}/setup_npm_with_no_sudo.sh
RUN cd ${SCRIPT_DIR}; ${SCRIPT_DIR}/setup_system_proxy.sh

########################################
#### update ubuntu and Install Python 3
Expand All @@ -29,6 +27,11 @@ RUN apt-get update -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG en_US.utf8

ENV INSTALL_DIR=${INSTALL_DIR:-/usr}

###################################
Expand All @@ -37,11 +40,11 @@ ENV INSTALL_DIR=${INSTALL_DIR:-/usr}
#### ---------------------------------------------------------------
#### ---- Change below when upgrading version ----
#### ---------------------------------------------------------------
## https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
## https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.tar.gz
ARG JAVA_MAJOR_VERSION=${JAVA_MAJOR_VERSION:-8}
ARG JAVA_UPDATE_VERSION=${JAVA_UPDATE_VERSION:-201}
ARG JAVA_BUILD_NUMBER=${JAVA_BUILD_NUMBER:-09}
ARG JAVA_DOWNLOAD_TOKEN=${JAVA_DOWNLOAD_TOKEN:-42970487e3af4f5aa5bca3f542482c60}
ARG JAVA_UPDATE_VERSION=${JAVA_UPDATE_VERSION:-202}
ARG JAVA_BUILD_NUMBER=${JAVA_BUILD_NUMBER:-08}
ARG JAVA_DOWNLOAD_TOKEN=${JAVA_DOWNLOAD_TOKEN:-1961070e4c9b4e26a04e7f5a083f551e}

#### ---------------------------------------------------------------
#### ---- Don't change below unless you know what you are doing ----
Expand Down Expand Up @@ -111,13 +114,13 @@ RUN ln -s ${JAVA_HOME_ACTUAL} ${JAVA_HOME} && \
#### ---- Install Gradle ---- #####
###################################
ARG GRADLE_INSTALL_BASE=${GRADLE_INSTALL_BASE:-/opt/gradle}
ARG GRADLE_VERSION=${GRADLE_VERSION:-5.1.1}
ARG GRADLE_VERSION=${GRADLE_VERSION:-5.2.1}

ARG GRADLE_HOME=${GRADLE_INSTALL_BASE}/gradle-${GRADLE_VERSION}
ENV GRADLE_HOME=${GRADLE_HOME}
ARG GRADLE_PACKAGE=gradle-${GRADLE_VERSION}-bin.zip
ARG GRADLE_PACKAGE_URL=https://services.gradle.org/distributions/${GRADLE_PACKAGE}
# https://services.gradle.org/distributions/gradle-5.1.1-bin.zip
# https://services.gradle.org/distributions/gradle-5.2.1-bin.zip
RUN mkdir -p ${GRADLE_INSTALL_BASE} && \
cd ${GRADLE_INSTALL_BASE} && \
wget -c ${GRADLE_PACKAGE_URL} && \
Expand Down
62 changes: 44 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Java 8 (1.8.0_201) JDK + Maven 3.6 + Python 3.5 + PIP3 18.1 + node 11.7.0 + npm 6.5.0 + Gradle 5.1
# Java 8 (1.8.0_202) JDK + Maven 3.6 + Python 3.5 + pip 19.0 + node 11.9 + npm 6.5 + Gradle 5.2

[![](https://images.microbadger.com/badges/image/openkbs/jdk-mvn-py3.svg)](https://microbadger.com/images/openkbs/jdk-mvn-py3 "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/openkbs/jdk-mvn-py3.svg)](https://microbadger.com/images/openkbs/jdk-mvn-py3 "Get your own version badge on microbadger.com")

Expand All @@ -7,12 +7,12 @@ By using this image, you agree the [Oracle Java JDK License](http://www.oracle.c
This image contains [Oracle JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html). You must accept the [Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html) to use this image.

# Components:
* java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
* java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
* Apache Maven 3.6.0
* Python 3.5.2
* node v11.7.0 + npm 6.5.0 (from NodeSource official Node Distribution)
* Python 3.5.2 / Python 2.7.12 + pip 19.0.2
* Node v11.9.0 + npm 6.5.0 (from NodeSource official Node Distribution)
* Gradle 5.1
* Other tools: git wget unzip vim python python-setuptools python-dev python-numpy

Expand Down Expand Up @@ -161,18 +161,43 @@ For example, try the following Docker-based IDEs:

# Releases information
```
root@cb9f39f3bd74:/data# /usr/printVersions.sh
RUN_TYPE=0
RUN_OPTION= -it
RESTART_OPTION=no
REMOVE_OPTION= --rm
--- INFO: Docker Run Environment file './docker-run.env' FOUND!
-v /home/user1/data-docker/jdk-mvn-py3/data:/home/developer/data -v /home/user1/data-docker/jdk-mvn-py3/workspace:/home/developer/workspace
PORT_MAP=
ENV_VARS=
... Setup Docker Run Proxy: ...
ENV_VARS=
Ubuntu ... not SE-Lunix ... no privileged needed
---------------------------------------------
---- Starting a Container for openkbs/jdk-mvn-py3
---------------------------------------------
--------------------------------------------------------
==> Commands to manage Container:
--------------------------------------------------------
./shell.sh : to shell into the container
./stop.sh : to stop the container
./log.sh : to show the docker run log
./build.sh : to build the container
./commit.sh: to push the container image to docker hub
--------------------------------------------------------
+ docker run --rm -it --name=jdk-mvn-py3 --restart=no -v /home/user1/data-docker/jdk-mvn-py3/data:/home/developer/data -v /home/user1/data-docker/jdk-mvn-py3/workspace:/home/developer/workspace openkbs/jdk-mvn-py3 /usr/printVersions.sh
+ echo JAVA_HOME=/usr/java
JAVA_HOME=/usr/java
+ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
+ mvn --version
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
Maven home: /usr/apache-maven-3.6.0
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /usr/jdk1.8.0_201/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: /usr/jdk1.8.0_202/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-45-generic", arch: "amd64", family: "unix"
+ python -V
Python 2.7.12
Expand All @@ -185,17 +210,17 @@ pip 19.0.2 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
+ gradle --version
------------------------------------------------------------
Gradle 5.1.1
Gradle 5.2.1
------------------------------------------------------------
Build time: 2019-01-10 23:05:02 UTC
Revision: 3c9abb645fb83932c44e8610642393ad62116807
Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.1
Kotlin: 1.3.11
Kotlin DSL: 1.1.3
Kotlin: 1.3.20
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_201 (Oracle Corporation 25.201-b09)
JVM: 1.8.0_202 (Oracle Corporation 25.202-b08)
OS: Linux 4.15.0-45-generic amd64
+ npm -v
Expand All @@ -218,4 +243,5 @@ SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
+ set +x
```
10 changes: 5 additions & 5 deletions docker-build.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#### Java JDK #####
###################################
JAVA_MAJOR_VERSION=8
JAVA_UPDATE_VERSION=201
JAVA_BUILD_NUMBER=09
JAVA_DOWNLOAD_TOKEN=42970487e3af4f5aa5bca3f542482c60
## https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
JAVA_UPDATE_VERSION=202
JAVA_BUILD_NUMBER=08
JAVA_DOWNLOAD_TOKEN=1961070e4c9b4e26a04e7f5a083f551e
## https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.tar.gz

###################################
#### Rider configuration for run.sh ####
Expand All @@ -25,7 +25,7 @@ JAVA_DOWNLOAD_TOKEN=42970487e3af4f5aa5bca3f542482c60
#### ---- Install Gradle ----
###################################
GRADLE_INSTALL_BASE=/opt/gradle
GRADLE_VERSION=5.1.1
GRADLE_VERSION=5.2.1

###################################
#### ---- Install Maven ----
Expand Down
31 changes: 0 additions & 31 deletions script/setup_apt_proxy.sh

This file was deleted.

23 changes: 0 additions & 23 deletions script/setup_npm_proxy.sh

This file was deleted.

19 changes: 0 additions & 19 deletions script/setup_npm_with_no_sudo.sh

This file was deleted.

84 changes: 84 additions & 0 deletions script/setup_system_proxy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash -x

echo "####################### Components: $(basename $0) ###########################"

#### -------------------------------------------------
#### OS_TYPE=1:Ubuntu, 2:Centos,, 0: OS_TYPE_NOT_FOUND
#### -------------------------------------------------
OS_TYPE=0

REPO_CONF=/etc/apt/apt.conf
ETC_ENV=/etc/environment

function detectOS() {
os_name="`cat /etc/os-release | grep -i '^NAME=\"Ubuntu\"' | awk -F= '{print $2}' | tr '[:upper:]' '[:lower:]' |sed 's/"//g' `"
case ${os_name} in
ubuntu*)
OS_TYPE=1
REPO_CONF=/etc/apt/apt.conf
ETC_ENV=/etc/environment
;;
centos*)
OS_TYPE=2
REPO_CONF=/etc/yum.conf
ETC_ENV=/etc/environment
;;
*)
OS_TYPE=0
REPO_CONF=
ETC_ENV=
echo "***** ERROR: Can't detect OS Type (e.g., Ubuntu, Centos)! *****"
echo "Abort now!"
exit 9
;;
esac
}
detectOS

HAS_PROXY=0
function detectProxySetup() {
proxy_vars="`env | grep -i proxy`"
if [ ! "${proxy_vars}" = "" ]; then
HAS_PROXY=1
echo -e ">>>> $0: Found proxy environment vars setup found! \n Setup ${REPO_CONF} & ${ETC_ENV} for proxy servers URLs!"
else
echo -e ">>>> $0: No proxy vars setup found! \n No need to setup ${REPO_CONF} & ${ETC_ENV} for proxy servers URLs!"
exit 0
fi
}
detectProxySetup

#### ---- Format (Ubuntu): /etc/apt/apt.conf Proxy Server URL ---- ####
# Acquire::http::Proxy "http://user:pass@proxy_host:port";
# Other way:
# sudo apt-get -o Acquire::http::proxy=false <update/install>
# sudo apt-get -o Acquire::http::proxy=http://proxy.openkbs.org:80/ <update/install>
function addProxyToAptConf() {
if [ ${HAS_PROXY} -gt 0 ]; then
[ ! -z "${http_proxy}" ] && echo "Acquire::http::Proxy \"${http_proxy}\";" | sudo tee -a ${REPO_CONF}
[ ! -z "${https_proxy}" ] && echo "Acquire::https::Proxy \"${https_proxy}\";" | sudo tee -a ${REPO_CONF}
[ ! -z "${ftp_proxy}" ] && echo "Acquire::ftp::Proxy \"${ftp_proxy}\";" | sudo tee -a ${REPO_CONF}
fi
}
addProxyToAptConf ${http_proxy}

function addProxyToEtcEnv() {
if [ ${HAS_PROXY} -gt 0 ]; then
[ ! -z "${http_proxy}" ] && echo "http_proxy=${http_proxy}" | sudo tee -a ${ETC_ENV}
[ ! -z "${https_proxy}" ] && echo "https_proxy=${https_proxy}" | sudo tee -a ${ETC_ENV}
[ ! -z "${ftp_proxy}" ] && echo "ftp_proxy=${ftp_proxy}" | sudo tee -a ${ETC_ENV}
[ ! -z "${no_proxy}" ] && echo "no_proxy=\"${no_proxy}\"" | sudo tee -a ${ETC_ENV}
fi
}
addProxyToEtcEnv

function setupNpmProxy() {
if [ ${HAS_PROXY} -gt 0 ] && [ "`which npm`" != "" ]; then
npm config set proxy ${http_proxy} && \
npm config set http_proxy ${http_proxy} && \
npm config set https_proxy ${https_proxy}
fi
}
setupNpmProxy ${http_proxy}


0 comments on commit 2e70db1

Please sign in to comment.