Adding the Docker packaging script

This commit is contained in:
Kohsuke Kawaguchi 2014-05-01 11:16:21 -07:00
parent d2eddf21b4
commit 2eca02b6fc
5 changed files with 46 additions and 3 deletions

.gitignore vendored
View File

@ -3,3 +3,4 @@

Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM ubuntu:trusty
RUN apt-get install -y openjdk-6-jre unzip
RUN useradd --create-home accountapp
ADD bin /home/accountapp/bin
ADD target/accountapp.war /home/accountapp/bin/accountapp.war
USER accountapp
ENTRYPOINT /home/accountapp/bin/

Makefile Normal file
View File

@ -0,0 +1,22 @@
TAG=$(shell date '+%Y%m%d_%H%M%S')
target/accountapp.war :
mvn install
bin/jetty-runner.jar :
wget -O bin/jetty-runner.jar ''
image : target/accountapp.war bin/jetty-runner.jar
docker build -t ${IMAGENAME} .
run :
docker run -P --rm -i -t -v ${PWD}:/etc/accountapp ${IMAGENAME}
tag :
docker tag ${IMAGENAME} ${IMAGENAME}:${TAG}
push :
docker push ${IMAGENAME}

bin/ Executable file
View File

@ -0,0 +1,3 @@
cd "$(dirname "$0")"
exec java -DCONFIG=/etc/accountapp/ -jar jetty-runner.jar --port 8080 --path /account accountapp.war

View File

@ -1,5 +1,4 @@
Testing locally
# Testing locally
First, set up a tunnel to Jenkins LDAP server. Run the following command and keep the terminal open:
ssh -L 9389:localhost:389
@ -20,4 +19,10 @@ Finally, run the application with Jetty, then access `http://localhost:8080/`:
mvn jetty:run
(As you can see above, this connects your test instance to the actual LDAP server, so the data you'll be seeing
is real.
is real.
# Packaging
For deploying to production, this app gets containerized. The container expects to see `/etc/accountapp` mounted
from outside that contains the abovementioned ``