Skip to content

Instantly share code, notes, and snippets.

@lumue
Last active October 31, 2015 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lumue/7f88d5e0c54db75c5e70 to your computer and use it in GitHub Desktop.
Save lumue/7f88d5e0c54db75c5e70 to your computer and use it in GitHub Desktop.
dockerfile for a glassfish4 container and a customized domain
#!/bin/bash
jar -cf template-domain.jar -C template-domain *
docker build -t lumue/webapp-gf4 .
FROM java:8-jdk
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV GLASSFISH_HOME /usr/local/glassfish4
ENV PATH $PATH:$JAVA_HOME/bin:$GLASSFISH_HOME/bin
RUN apt-get update && \
apt-get install -y curl unzip zip inotify-tools && \
rm -rf /var/lib/apt/lists/*
RUN curl -L -o /tmp/glassfish-4.1.zip http://download.java.net/glassfish/4.1/release/glassfish-4.1.zip && \
unzip /tmp/glassfish-4.1.zip -d /usr/local && \
rm -f /tmp/glassfish-4.1.zip
EXPOSE 8080 4848 8181
WORKDIR /usr/local/glassfish4
#Here start our modifications!
ADD template-domain.jar /usr/local/glassfish4/template-domain.jar
ADD password.txt /usr/local/glassfish4/password.txt
RUN asadmin create-domain --template template-domain.jar --user admin --passwordfile password.txt webapp && asadmin start-domain webapp && asadmin --host localhost --port 4848 --user admin --passwordfile password.txt enable-secure-admin && asadmin stop-domain webapp
# verbose causes the process to remain in the foreground so that docker can track it
CMD asadmin start-domain --verbose webapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment