Skip to content

DragD/jdk-mvn-py3

 
 

Repository files navigation

Java 8 (1.8.0_191) JDK + Maven 3.6 + Python 3.5 + PIP3 18.1 + + npm 3.5.2 + nodejs v4.2.6 + Gradle 5.1

License Agreement

By using this image, you agree the Oracle Java JDK License. This image contains Oracle JDK 8. You must accept the Oracle Binary Code License Agreement for Java SE to use this image.

Components:

  • java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
  • Apache Maven 3.6.0
  • Python 3.5.2
  • npm 3.5.2 + nodejs v4.2.6
  • Gradle 5.1
  • Other tools: git wget unzip vim python python-setuptools python-dev python-numpy

Default Run (test) - Just entering Container

./run.sh

Test Java and Python3 Runs

./tryJava.sh
./tryPython.sh

Default Build (locally)

./build.sh

Pull the image from Docker Repository

docker pull openkbs/jdk-mvn-py3

Base the image to build add-on components

FROM openkbs/jdk-mvn-py3

Run the image

Then, you're ready to run:

  • make sure you create your work directory, e.g., ./data
mkdir ./data
docker run -d --name my-jdk-mvn-py3 -v $PWD/data:/data -i -t openkbs/jdk-mvn-py3

Build and Run your own image

Say, you will build the image "my/jdk-mvn-py3".

docker build -t my/jdk-mvn-py3 .

To run your own image, say, with some-jdk-mvn-py3:

mkdir ./data
docker run -d --name some-jdk-mvn-py3 -v $PWD/data:/data -i -t my/jdk-mvn-py3

Shell into the Docker instance

docker exec -it some-jdk-mvn-py3 /bin/bash

Run Python code

To run Python code

docker run -it --rm openkbs/jdk-mvn-py3 python3 -c 'print("Hello World")'

or,

docker run -i --rm openkbs/jdk-mvn-py3 python3 < myPyScript.py 

or,

mkdir ./data
echo "print('Hello World')" > ./data/myPyScript.py
docker run -it --rm --name some-jdk-mvn-py3 -v "$PWD"/data:/data openkbs/jdk-mvn-py3 python3 myPyScript.py

or,

alias dpy3='docker run --rm openkbs/jdk-mvn-py3 python3'
dpy3 -c 'print("Hello World")'

Compile or Run java while no local installation needed

Remember, the default working directory, /data, inside the docker container -- treat is as "/". So, if you create subdirectory, "./data/workspace", in the host machine and the docker container will have it as "/data/workspace".

#!/bin/bash -x
mkdir ./data
cat >./data/HelloWorld.java <<-EOF
public class HelloWorld {
   public static void main(String[] args) {
      System.out.println("Hello, World");
   }
}
EOF
cat ./data/HelloWorld.java
alias djavac='docker run -it --rm --name some-jdk-mvn-py3 -v '$PWD'/data:/data openkbs/jdk-mvn-py3 javac'
alias djava='docker run -it --rm --name some-jdk-mvn-py3 -v '$PWD'/data:/data openkbs/jdk-mvn-py3 java'

djavac HelloWorld.java
djava HelloWorld

And, the output:

Hello, World

Hence, the alias above, "djavac" and "djava" is your docker-based "javac" and "java" commands and it will work the same way as your local installed Java's "javac" and "java" commands.

To run specialty Java/Scala IDE alternatives

However, for larger complex projects, you might want to consider to use Docker-based IDE. For example, try the following Docker-based IDEs:

See also

Releases information

root@b0002788171b:/usr# ./printVersions.sh 
+ echo JAVA_HOME=/usr/java
JAVA_HOME=/usr/java
+ java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, 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_191, vendor: Oracle Corporation, runtime: /usr/jdk1.8.0_191/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.15.0-43-generic", arch: "amd64", family: "unix"
+ python -V
Python 2.7.12
+ python3 -V
Python 3.5.2
+ pip --version
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
+ pip3 --version
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
+ gradle --version

------------------------------------------------------------
Gradle 5.1.1
------------------------------------------------------------

Build time:   2019-01-10 23:05:02 UTC
Revision:     3c9abb645fb83932c44e8610642393ad62116807

Kotlin DSL:   1.1.1
Kotlin:       1.3.11
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Linux 4.15.0-43-generic amd64

+ npm --version
3.5.2
+ nodejs --version
v4.2.6
+ cat /etc/lsb-release /etc/os-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

About

Java 8 JDK + Maven 3 + Python 3

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 82.6%
  • Dockerfile 17.4%