Adding the Docker packaging script
This commit is contained in:
parent
d2eddf21b4
commit
2eca02b6fc
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
*.iws
|
||||
target
|
||||
config.properties
|
||||
bin/jetty-runner.jar
|
12
Dockerfile
Normal file
12
Dockerfile
Normal 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
|
||||
|
||||
EXPOSE 8080
|
||||
USER accountapp
|
||||
|
||||
ENTRYPOINT /home/accountapp/bin/run.sh
|
22
Makefile
Normal file
22
Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
IMAGENAME=jenkinsciinfra/account-app
|
||||
TAG=$(shell date '+%Y%m%d_%H%M%S')
|
||||
|
||||
target/accountapp.war :
|
||||
mvn install
|
||||
|
||||
bin/jetty-runner.jar :
|
||||
wget -O bin/jetty-runner.jar 'http://search.maven.org/remotecontent?filepath=org/mortbay/jetty/jetty-runner/8.1.15.v20140411/jetty-runner-8.1.15.v20140411.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}
|
||||
|
||||
|
3
bin/run.sh
Executable file
3
bin/run.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
exec java -DCONFIG=/etc/accountapp/config.properties -jar jetty-runner.jar --port 8080 --path /account accountapp.war
|
11
readme.md
11
readme.md
@ -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 cucumber.jenkins-ci.org
|
||||
@ -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 `config.properties`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user