Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Create jetty9 image, fix entrypoint for java7
Browse files Browse the repository at this point in the history
The idea is that both will have a known-entrypoint of /run

App code (jars or wars) will go into /app
  • Loading branch information
justinsb committed May 3, 2015
1 parent 5df4287 commit 44df38f
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.build/
image.aci.asc

20 changes: 15 additions & 5 deletions bin/packages2aci
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ mkdir -p ${BUILD}/packages/

# start from an empty build directory every time
rm -rf ${BUILD}/layout
mkdir -p ${BUILD}/layout/rootfs/
ROOTFS=${BUILD}/layout/rootfs/
mkdir -p ${ROOTFS}

# download packages specified in packages
for p in `cat ${SRCDIR}/packages`; do
Expand All @@ -39,25 +40,34 @@ for p in `cat ${SRCDIR}/packages`; do
done

# extract the packages into the rootfs dir
shopt -s nullglob
for d in ${BUILD}/packages/*.deb; do
echo "Extracting $d"
dpkg-deb -x ${d} ${BUILD}/layout/rootfs/
dpkg-deb -x ${d} ${ROOTFS}
done

# copy the ACI manifest file
cp ${SRCDIR}/manifest ${BUILD}/layout/

# Copy a rootfs/ directory, if present in src
if [[ -d ${SRCDIR}/rootfs/ ]]; then
# TODO: Nicer syntax?
cp -av ${SRCDIR}/rootfs/ ${ROOTFS}/../
fi

# call user postbuild script
if [[ -x ${SRCDIR}/postbuild ]]; then
pushd ${BUILD}/layout/rootfs
${SRCDIR}/postbuild ${BUILD}/layout/rootfs
pushd ${ROOTFS}
${SRCDIR}/postbuild ${ROOTFS} ${SRCDIR}
popd
fi

# build the ACI
actool build --overwrite ${BUILD}/layout/ ${OUTPUT}
# Remove the signature - it will now be invalid
rm -f ${OUTPUT}.asc

# great success
echo "Your image is now available at ${OUTPUT}"
echo "Test with: sudo rkt --insecure-skip-verify=true run ${OUTPUT}"
echo "Test with: sudo rkt --insecure-skip-verify run ${OUTPUT}"

18 changes: 16 additions & 2 deletions java7/manifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
{
"acVersion": "0.5.1",
"acKind": "ImageManifest",
"name": "java",
"name": "aci.justinsb.com/java7",
"labels": [
{
"name": "version",
"value": "7.75.0"
},
{
"name": "arch",
"value": "amd64"
},
{
"name": "os",
"value": "linux"
}
],
"app": {
"exec": [ "/java", "-version" ],
"exec": [ "/run" ],
"user": "0",
"group": "0"
}
Expand Down
5 changes: 4 additions & 1 deletion java7/packages
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ libxtst6
openjdk-7-jre
openjdk-7-jre-headless
tzdata-java
zlib1g
zlib1g
bash
libncurses5
libtinfo5
4 changes: 3 additions & 1 deletion java7/postbuild
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash -e

ROOTFS=${1}
cd ${ROOTFS}
SRCDIR=${2}

# symlink java
cd ${ROOTFS}
ln -s usr/lib/jvm/java-7-openjdk-amd64/bin/java java

20 changes: 20 additions & 0 deletions java7/rootfs/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

MAIN_CLASS=$1
WORKDIR=/app
MAIN_JAR=/app/app.jar

JAVA_ARGS=""
CP=""
if [[ -n "${MAIN_CLASS}" ]]; then
shift
CP=${MAIN_JAR}
CP=${CP}:"/app/lib/*"
JAVA_ARGS="${JAVA_ARGS} ${MAIN_CLASS}"
else
CP="/app/lib/*"
JAVA_ARGS="${JAVA_ARGS} -jar ${MAIN_JAR}"
fi

cd ${WORKDIR}
/java -cp "${CP}" ${JAVA_ARGS} $@
4 changes: 4 additions & 0 deletions jetty9/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.build/
image.aci
downloads/

27 changes: 27 additions & 0 deletions jetty9/manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"acVersion": "0.5.1",
"acKind": "ImageManifest",
"name": "aci.justinsb.com/jetty9",
"labels": [
{
"name": "version",
"value": "9.2.10.0"
},
{
"name": "arch",
"value": "amd64"
},
{
"name": "os",
"value": "linux"
}
],
"app": {
"exec": [ "/run" ],
"user": "0",
"group": "0"
},
"dependencies": [
{"app":"aci.justinsb.com/java7"}
]
}
3 changes: 3 additions & 0 deletions jetty9/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
libselinux1
libffi6
libpcre3
17 changes: 17 additions & 0 deletions jetty9/postbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

ROOTFS=${1}
SRCDIR=${2}

mkdir -p ${SRCDIR}/downloads
pushd ${SRCDIR}/downloads
wget -N "http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.2.10.v20150310.tar.gz"
popd

cd ${ROOTFS}
mkdir -p jetty
tar -x -z --strip-components=1 -C jetty -f ${SRCDIR}/downloads/jetty-distribution-9.2.10.v20150310.tar.gz

pushd jetty/webapps
ln -s ../../app/root.war
popd
4 changes: 4 additions & 0 deletions jetty9/rootfs/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/dash

cd /jetty
/java -jar start.jar

0 comments on commit 44df38f

Please sign in to comment.