Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dockerfile to build an image #140

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
@@ -0,0 +1,7 @@
.git
.gitignore

.dockerignore
Dockerfile

target
22 changes: 22 additions & 0 deletions Dockerfile
@@ -0,0 +1,22 @@
# Use a multistage build to first build the pipeline using maven. Then
# copy the artifacts into a final image which exposes the port and
# starts the pipeline.

# Build the pipeline first
FROM maven:3.5-jdk-8 as builder
ADD . /usr/src/daisy-pipeline2
WORKDIR /usr/src/daisy-pipeline2
RUN mvn clean package

# then use the build artifacts to create an image where the pipeline is installed
FROM openjdk:8-jre
LABEL maintainer="DAISY Consortium (http://www.daisy.org/)"
COPY --from=builder /usr/src/daisy-pipeline2/target/pipeline2-*_linux/daisy-pipeline /opt/daisy-pipeline2
ENV PIPELINE2_LOCAL=false \
PIPELINE2_AUTH=true \
PIPELINE2_WS_AUTHENTICATION_KEY=clientid \
PIPELINE2_WS_AUTHENTICATION_SECRET=sekret
EXPOSE 8181
# for the healthcheck use PIPELINE2_HOST if defined. Otherwise use localhost
HEALTHCHECK --interval=30s --timeout=10s --start-period=1m CMD curl --fail http://${PIPELINE2_WS_HOST-localhost}:${PIPELINE2_WS_PORT:-8181}/${PIPELINE2_WS_PATH:-ws}/alive || exit 1
ENTRYPOINT ["/opt/daisy-pipeline2/bin/pipeline2"]
9 changes: 9 additions & 0 deletions Dockerfile.without_builder
@@ -0,0 +1,9 @@
FROM openjdk:8-jre
LABEL maintainer="DAISY Consortium (http://www.daisy.org/)"
ADD target/pipeline2-*_linux/daisy-pipeline /opt/daisy-pipeline2
ENV PIPELINE2_LOCAL=false \
PIPELINE2_AUTH=true \
PIPELINE2_WS_AUTHENTICATION_KEY=clientid \
PIPELINE2_WS_AUTHENTICATION_SECRET=sekret
EXPOSE 8181
ENTRYPOINT ["/opt/daisy-pipeline2/bin/pipeline2"]
15 changes: 15 additions & 0 deletions Makefile
@@ -0,0 +1,15 @@
help :
echo "make docker:" >&2
echo " Build a Docker image" >&2
echo "make check-docker:" >&2
echo " Test the Docker image" >&2

docker :
gtar -cz \
target/pipeline2-*_linux \
Dockerfile.without_builder \
--transform='s/Dockerfile.without_builder/Dockerfile/' \
| docker build -t daisyorg/pipeline2 -

check-docker :
bash src/test/resources/test-docker-image.sh
108 changes: 8 additions & 100 deletions pom.xml
Expand Up @@ -9,15 +9,15 @@
</parent>
<groupId>org.daisy.pipeline</groupId>
<artifactId>assembly</artifactId>
<version>1.10.3</version>
<version>1.10.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>DAISY Pipeline 2 :: Assembly</name>
<description>Builds the main distribution of the DAISY Pipeline 2.</description>
<scm>
<connection>scm:git:git@github.com:daisy-consortium/pipeline-assembly.git</connection>
<url>scm:git:git@github.com:daisy-consortium/pipeline-assembly.git</url>
<developerConnection>scm:git:git@github.com:daisy-consortium/pipeline-assembly.git</developerConnection>
<tag>v1.10.3</tag>
<tag>HEAD</tag>
</scm>
<properties>
<cli.version>2.1.0</cli.version>
Expand Down Expand Up @@ -52,14 +52,14 @@
<dependency>
<groupId>org.daisy.pipeline</groupId>
<artifactId>framework-bom</artifactId>
<version>1.10.4</version>
<version>1.10.5-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules</groupId>
<artifactId>scripts-bom</artifactId>
<version>1.10.1</version>
<version>1.10.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -761,6 +761,10 @@
<groupId>org.daisy.pipeline.modules</groupId>
<artifactId>dtbook-to-html</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.daisy.pipeline.modules</groupId>
<artifactId>dtbook-to-rtf</artifactId>
</artifactItem>
<artifactItem>
<groupId>org.daisy.pipeline.modules</groupId>
<artifactId>dtbook-to-ssml</artifactId>
Expand Down Expand Up @@ -2817,102 +2821,6 @@ rm -rf /opt/daisy-pipeline2/cli
</build>
</profile>

<profile>
<id>webui</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.daisy.pipeline</groupId>
<artifactId>webui-desktop</artifactId>
<version>1.8.1</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>target/webui</outputDirectory>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>dist-webui-mac</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/webui-mac.xml</descriptor>
</descriptors>
<filters>
<filter>src/main/assembly/dist.properties</filter>
<filter>src/main/assembly/dist-nix.properties</filter>
</filters>
<appendAssemblyId>false</appendAssemblyId>
<finalName>pipeline2-${project.version}-webui_mac</finalName>
</configuration>
</execution>
<execution>
<id>dist-webui-linux</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/webui-linux.xml</descriptor>
</descriptors>
<filters>
<filter>src/main/assembly/dist.properties</filter>
<filter>src/main/assembly/dist-nix.properties</filter>
</filters>
<appendAssemblyId>false</appendAssemblyId>
<finalName>pipeline2-${project.version}-webui_linux</finalName>
</configuration>
</execution>
<execution>
<id>dist-webui-win</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/webui-win.xml</descriptor>
</descriptors>
<filters>
<filter>src/main/assembly/dist.properties</filter>
<filter>src/main/assembly/dist-win.properties</filter>
</filters>
<appendAssemblyId>false</appendAssemblyId>
<finalName>pipeline2-${project.version}-webui_windows</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>
<repositories>
<!--
Expand Down
31 changes: 0 additions & 31 deletions src/main/assembly/components/webui.xml

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/assembly/webui-linux.xml

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/assembly/webui-mac.xml

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/assembly/webui-win.xml

This file was deleted.

5 changes: 3 additions & 2 deletions src/main/deb/etc/default/daisy-pipeline2
@@ -1,7 +1,8 @@
# Configuration file for /etc/init.d/daisy-pipeline2

# Execute pipeline in remote mode
#REMOTE=true
# Execute pipeline in remote mode and with authentication
#export PIPELINE2_WS_LOCALFS=true
#export PIPELINE2_WS_AUTHENTICATION=false

# Java heap size
#export JAVA_MIN_MEM=256M
Expand Down
5 changes: 0 additions & 5 deletions src/main/deb/etc/init.d/daisy-pipeline2
Expand Up @@ -27,11 +27,6 @@ SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Set daemon argument list
if [ "$REMOTE" = "true" ]; then
DAEMON_ARGS="remote"
fi

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

Expand Down
33 changes: 14 additions & 19 deletions src/main/resources/bin/pipeline2
Expand Up @@ -354,24 +354,11 @@ init() {
}

run() {
if [ "x$PIPELINE2_AUTH" = "x" ]; then
PIPELINE2_AUTH="-Dorg.daisy.pipeline.ws.authentication=false"
export PIPELINE2_AUTH
else
PIPELINE2_AUTH="-Dorg.daisy.pipeline.ws.authentication=$PIPELINE2_AUTH"
export PIPELINE2_AUTH

fi
if [ "x$PIPELINE2_LOCAL" = "x" ]; then
PIPELINE2_LOCAL="-Dorg.daisy.pipeline.ws.localfs=true"
export PIPELINE2_LOCAL
else
PIPELINE2_LOCAL="-Dorg.daisy.pipeline.ws.localfs=$PIPELINE2_LOCAL"
export PIPELINE2_LOCAL
# set defaults
PIPELINE2_WS_LOCALFS=true
PIPELINE2_WS_AUTHENTICATION=false

fi
MAIN=org.apache.felix.main.Main
OPTS="$PIPELINE2_LOCAL $PIPELINE2_AUTH"
MODE=" -Dorg.daisy.pipeline.main.mode=webservice"

case "$1" in
Expand All @@ -383,11 +370,13 @@ run() {
# shift
# ;;
'remote')
OPTS="-Dorg.daisy.pipeline.ws.localfs=false -Dorg.daisy.pipeline.ws.authentication=true"
PIPELINE2_LOCALFS=false
PIPELINE2_AUTH=true
shift
;;
'local')
OPTS="-Dorg.daisy.pipeline.ws.localfs=true -Dorg.daisy.pipeline.ws.authentication=false"
PIPELINE2_LOCALFS=true
PIPELINE2_AUTH=false
shift
;;
'clean')
Expand Down Expand Up @@ -437,7 +426,13 @@ run() {
fi
cd "$PIPELINE2_BASE"

eval exec "\"$JAVA"\" "$JAVA_OPTS" -Djava.endorsed.dirs="\"${JAVA_ENDORSED_DIRS}"\" -Djava.ext.dirs="\"${JAVA_EXT_DIRS}"\" -Dorg.daisy.pipeline.home="\"$PIPELINE2_HOME"\" -Dorg.daisy.pipeline.base="\"$PIPELINE2_BASE"\" -Dorg.daisy.pipeline.data="\"$PIPELINE2_DATA"\" -Dfelix.config.properties="\"file:$PIPELINE2_HOME/etc/config.properties"\" -Dfelix.system.properties="\"file:$PIPELINE2_CONFIG/system.properties"\" $FELIX_OPTS $PIPELINE2_OPTS $OPTS $MODE -classpath "\"$CLASSPATH"\" $MAIN "\"$@"\"
export PIPELINE2_HOME
export PIPELINE2_BASE
export PIPELINE2_DATA
export PIPELINE2_WS_LOCALFS
export PIPELINE2_WS_AUTHENTICATION

eval exec "\"$JAVA"\" "$JAVA_OPTS" -Djava.endorsed.dirs="\"${JAVA_ENDORSED_DIRS}"\" -Djava.ext.dirs="\"${JAVA_EXT_DIRS}"\" -Dfelix.config.properties="\"file:$PIPELINE2_HOME/etc/config.properties"\" -Dfelix.system.properties="\"file:$PIPELINE2_CONFIG/system.properties"\" $FELIX_OPTS $MODE -classpath "\"$CLASSPATH"\" $MAIN "\"$@"\"
}

main() {
Expand Down