diff --git a/jboss/7.0.2/Dockerfile b/jboss/7.0.2/Dockerfile new file mode 100644 index 0000000..61ee144 --- /dev/null +++ b/jboss/7.0.2/Dockerfile @@ -0,0 +1,22 @@ +FROM dockerfile/java + +MAINTAINER georgi@consol.de + +EXPOSE 8080 + +ENV JBOSS_VERSION 7.0.2 +ENV JBOSS_DIR /opt/jboss-as-web-${JBOSS_VERSION}.Final +ENV DEPLOY_DIR /maven + +ENV http_proxy 10.250.0.180:8001 +RUN wget http://download.jboss.org/jbossas/7.0/jboss-as-${JBOSS_VERSION}.Final/jboss-as-web-${JBOSS_VERSION}.Final.tar.gz -O /tmp/jboss.tar.gz + +# Unpack +RUN tar xzf /tmp/jboss.tar.gz -C /opt +RUN ln -s ${JBOSS_DIR} /opt/jboss +RUN rm /tmp/jboss.tar.gz + +# Startup script +ADD deploy-and-run.sh ${JBOSS_DIR}/bin/ + +CMD /opt/jboss/bin/deploy-and-run.sh diff --git a/jboss/7.0.2/README.md b/jboss/7.0.2/README.md new file mode 100644 index 0000000..da88f53 --- /dev/null +++ b/jboss/7.0.2/README.md @@ -0,0 +1,25 @@ +## Apache Tomcat 8.0 + +A simple docker build for installing a vanilla Tomcat 8.0 below +*/opt/tomcat*. It comes out of the box and is intended for use for +integration testing. + +During startup a directory /maven is checked for .war files. If there +are any, they are linked into Tomcat's webapp/ directory for automatic +deployment. This plays nicely with the Docker maven plugin from +https://github.com/rhuss/docker-maven-plugin/ and its 'assembly' mode which +can automatically can create Docker data container with Maven artefacts +exported from a directory "/maven". + +Features: + +* Tomcat Version: **8.0.9** +* Java Version: **Oracle 1.7.0_51-b13** (base image: *dockerfile/java*) +* Port: **8080** +* User **admin** (Password: **admin**) has been added to access the admin + applications */host-manager* and */manager*) +* Documentation and examples have been removed +* Command: `/opt/tomcat/bin/deploy-and-run.sh` which links .war files from */maven* to + */opt/tomcat/webapps* and then calls `catalina.sh run` +* Sets `-Djava.security.egd=file:/dev/./urandom` for faster startup times + (though a bit less secure) diff --git a/jboss/7.0.2/boot2docker-fwd b/jboss/7.0.2/boot2docker-fwd new file mode 100644 index 0000000..0dec4bb --- /dev/null +++ b/jboss/7.0.2/boot2docker-fwd @@ -0,0 +1,150 @@ +#!/bin/bash + +usage () +{ + cat <" or "udp" +-h Forward HOST_PORT to the guest -- Defaults to the same number as GUEST_PORT +-p Forward tcp or udp traffic to GUEST_PORT -- Defaults to "tcp" +-i Bind the port forward to HOST_IP -- Defaults to the local only loopback, "127.0.0.1" +-d Delete the rule named RULE_NAME from the boot2docker-vm port forwards. +-l List the current port forwards defined for boot2docker-vm +-A Create forward rules for all the ports that docker uses by default with the -P option (49000-49900) +-D Delete all custom rules (i.e. everything except the "docker" and "ssh" rules) +GUEST_PORT The listening port inside boot2docker that will receive connections forwarded by the host + +Examples: +boot2docker-fwd 8000 +Rule tcp8000: tcp port 8000 on host IP 127.0.0.1 forwarded to guest port 8000 + +boot2docker-fwd -n fubar -h 8888 8000 +Rule fubar: tcp port 8888 on host IP 127.0.0.1 forwarded to guest port 8000 + +boot2docker-fwd -d fubar +Rule fubar deleted + +Notes: +Please don't delete the built in "docker" and "ssh" rules. Things will break. +UsageHERE +} + +list_rules_matching () +{ + VBoxManage showvminfo boot2docker-vm | grep "NIC [0-9]* Rule([0-9]*): *name = $1" +} + +if [ $# -eq 0 ] +then + usage + exit 1 +fi + +HOST_IP=127.0.0.1 +PROTOCOL=tcp + +while getopts "n:h:p:i:d:lAD" opt +do + case $opt in + n) + RULE_NAME="$OPTARG" + ;; + h) + if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null + then + HOST_PORT=$OPTARG + else + usage + exit 1 + fi + ;; + p) + if [ "$OPTARG" = "tcp" -o "$OPTARG" = "udp" ] + then + PROTOCOL=$OPTARG + else + usage + exit 1 + fi + ;; + i) + HOST_IP="$OPTARG" + ;; + d) + # Check for a numeric name, prefix the tcp default if so + if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null + then + RULE_NAME="tcp$OPTARG" + else + RULE_NAME="$OPTARG" + fi + list_rules_matching $RULE_NAME + if [ $? -eq 0 ] + then + VBoxManage controlvm boot2docker-vm natpf1 delete "$RULE_NAME" + if [ $? -eq 0 ] + then + echo "Rule deleted." + else + echo "Rule not deleted!" + fi + else + echo "Rule $RULE_NAME not found." + fi + exit $? + ;; + l) + list_rules_matching + exit 0 + ;; + A) + echo "Creating 1802 port forwarding rules. Please wait..." + for i in {49000..49900}; do + VBoxManage controlvm boot2docker-vm natpf1 "tcp-port$i,tcp,,$i,,$i" + VBoxManage controlvm boot2docker-vm natpf1 "udp-port$i,udp,,$i,,$i" + done + exit 0 + ;; + D) + NUM_RULES=$(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -cv ' docker\| ssh') + echo "Deleting $NUM_RULES port forwarding rules. Please wait..." + for rule in $(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -v ' docker\| ssh' | cut -d ' ' -f 3 ) + do + VBoxManage controlvm boot2docker-vm natpf1 delete "$rule" + done + exit 0 + ;; + esac +done + +if [ "$1" -eq "$1" ] 2>/dev/null +then + GUEST_PORT=$1 +else + usage + exit 1 +fi + +if [ -z "$RULE_NAME" ] +then + RULE_NAME="${PROTOCOL}${GUEST_PORT}" +fi + + +VBoxManage controlvm boot2docker-vm natpf1 "$RULE_NAME,$PROTOCOL,$HOST_IP,$HOST_PORT,,$GUEST_PORT" +if [ $? -eq 0 ] +then + list_rules_matching $RULE_NAME + echo "Rule created." +else + echo "Error creating rule!" +fi +exit $? + diff --git a/jboss/7.0.2/deploy-and-run.sh b/jboss/7.0.2/deploy-and-run.sh new file mode 100755 index 0000000..907e973 --- /dev/null +++ b/jboss/7.0.2/deploy-and-run.sh @@ -0,0 +1,13 @@ +#!/bin/sh +DIR=${DEPLOY_DIR:-/maven} +echo "Checking *.war in $DIR" +if [ -d $DIR ]; then + for i in $DIR/*.war; do + file=$(basename $i) + echo "Linking $i --> ${JBOSS_DIR}/standalone/deployments/$file" + ln -s $i ${JBOSS_DIR}/standalone/deployments/$file + done +fi +# Use faster (though more unsecure) random number generator +export JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom" +/opt/jboss/bin/standalone.sh -b 0.0.0.0 diff --git a/jboss/7.0.2/tomcat-users.xml b/jboss/7.0.2/tomcat-users.xml new file mode 100644 index 0000000..c49542d --- /dev/null +++ b/jboss/7.0.2/tomcat-users.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + +