Introduce a separate Java image and base all Java apps on it

This commit is contained in:
Disassembler 2018-03-30 21:58:04 +02:00
parent 5b714d0b10
commit 867a4c06ec
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
10 changed files with 35 additions and 42 deletions

View File

@ -2,6 +2,9 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/activemq
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# Build Docker container
docker build -t activemq ${SOURCE_DIR}

View File

@ -1,15 +1,6 @@
FROM alpine:3.7
FROM java
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
# Cleanup
&& apk --no-cache del paxctl
RUN \
# Download and install ActiveMQ
wget http://archive.apache.org/dist/activemq/5.15.2/apache-activemq-5.15.2-bin.tar.gz -O /tmp/activemq.tgz \

6
java.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
SOURCE_DIR=$(realpath $(dirname "${0}"))/java
# Build Docker container
docker build -t java ${SOURCE_DIR}

13
java/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM alpine:3.7
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/keytool \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/keytool \
# Cleanup
&& apk --no-cache del paxctl

3
omk.sh
View File

@ -2,6 +2,9 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/omk
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# Build Docker container
docker build -t omk ${SOURCE_DIR}

View File

@ -1,15 +1,6 @@
FROM alpine:3.7
FROM java
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
# Cleanup
&& apk --no-cache del paxctl
RUN \
# Install NodeJS runtime
apk --no-cache add nodejs paxctl \

View File

@ -2,6 +2,9 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/solr
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# Build Docker container
docker build -t solr ${SOURCE_DIR}

View File

@ -1,15 +1,6 @@
FROM alpine:3.7
FROM java
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
# Cleanup
&& apk --no-cache del paxctl
RUN \
# Install runtime dependencies
apk --no-cache add bash lsof

View File

@ -2,5 +2,8 @@
SOURCE_DIR=$(realpath $(dirname "${0}"))/tomcat
# Check prerequisites
docker image ls | grep -q java || $(realpath $(dirname "${0}"))/java.sh
# Build Docker container
docker build -t tomcat ${SOURCE_DIR}

View File

@ -1,17 +1,6 @@
FROM alpine:3.7
FROM java
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/keytool \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/keytool \
# Cleanup
&& apk --no-cache del paxctl
RUN \
# Install Tomcat 8
wget http://mirror.hosting90.cz/apache/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz -O /tmp/apache-tomcat-8.tgz \