mvpjava/spring-sts4-ide

By mvpjava

Updated almost 5 years ago

JDK + Spring Tool Suite IDE + git + maven

Image
2

438

spring-sts4-ide

Dockerfile and scripts needed to build, run and exec into Docker Container containing JDK (version is tagged in Docker image)

  • Spring Tools Suite 4 IDE + git +maven.

This Docker Container is treated as an executable, mainly starting STS4 IDE as a GUI via X11.

STS version: Depends on Docker image

You can check out the Blog Post: http://mvpjava.com/running-spring-tool-suite-4-docker/

You can check out the YouTube Tutorial: https://youtu.be/do_oNrPLftg

RUN CONTAINER

In order to run the STS4 container, run script ...

./run.sh

You should see the Spring Tools 4 Splash screen show up after the initial Docker image download from DockerHub

GETTING INTO CONTAINER

You can get into the container once its up with script ...

./exec.sh

You'll find yourself in a bash shell

RE-BUILDING IMAGE

If ever you wanted to change the username "mvpjava" or anything else in the Dockerfile, you could run script ...

./build.sh

Note: You will have to make the scripts executable from the command line via ...

chmod 755 $script_name

Dockerfile

I ended up downloading the tarballs to my machine and then adding them to the build instead of pulling them from online URL's via "curl" and "wget". I did this because links break over time and that means that the build just stops working one day when you want to update a version number in the URL. It just became too brittle. You'll see I use "ADD" now.

=========================================

FROM mvpjava/ubuntu-x11

MAINTAINER Andy Luis "MVP Java - mvpjava.com"

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update &&
apt-get install -y apt-utils &&
apt-get install -y libcanberra-gtk3-module &&
apt-get install -y curl wget git vim &&
apt-get clean all &&
sudo rm -rf /tmp/* &&
sudo rm -rf /var/cache/apk/*

###################################

Install Java

###################################

ENV INSTALL_DIR=${INSTALL_DIR:-/usr} ENV JAVA_HOME=${INSTALL_DIR}/jdk-14 ENV PATH=$PATH:${JAVA_HOME}/bin

WORKDIR ${INSTALL_DIR}

ADD jdk-14_linux-x64_bin.tar.gz .

###################################

Install STS4

###################################

WORKDIR /opt

ADD spring-tool-suite-4-4.6.0.RELEASE-e4.15.0-linux.gtk.x86_64.tar.gz .

###################################

Install Maven

###################################

ARG MAVEN_VERSION=${MAVEN_VERSION:-3.6.3} ENV MAVEN_VERSION=${MAVEN_VERSION} ENV MAVEN_HOME=/usr/apache-maven-${MAVEN_VERSION} ENV PATH $PATH:${MAVEN_HOME}/bin WORKDIR /usr ADD apache-maven-3.6.3-bin.tar.gz . RUN ln -s ${MAVEN_HOME} /usr/maven

ENV USER=mvpjava ENV HOME=/home/mvpjava ENV ECLIPSE_WORKSPACE=${HOME}/eclipse-workspace ENV USER_ID=1000 ENV GROUP_ID=1000

RUN useradd ${USER} &&
export uid=${USER_ID} gid=${GROUP_ID} &&
mkdir -m 700 -p ${HOME}/.eclipse ${ECLIPSE_WORKSPACE} &&
#chown ${USER}:${USER} ${HOME}/.eclipse ${ECLIPSE_WORKSPACE} &&
chown -R ${USER}:${USER} ${HOME} &&
ls -al ${HOME} &&
mkdir -p /etc/sudoers.d &&
echo "${USER}:x:${USER_ID}:${GROUP_ID}:${USER},,,:${HOME}:/bin/bash" >> /etc/passwd &&
echo "${USER}:x:${USER_ID}:" >> /etc/group &&
echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} &&
chmod 0440 /etc/sudoers.d/${USER}

RUN apt-get install -y docker.io RUN usermod -aG docker $USER

ENV DEBIAN_FRONTEND teletype

USER ${USER} WORKDIR ${ECLIPSE_WORKSPACE} CMD ["/opt/sts-4.6.0.RELEASE/SpringToolSuite4"]

Docker Pull Command

docker pull mvpjava/spring-sts4-ide