Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see #140
- Loading branch information
Showing
13 changed files
with
131 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.git | ||
.gitignore | ||
|
||
.dockerignore | ||
Dockerfile | ||
|
||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This test starts the pipeline inside a Docker container and then | ||
# starts the dtbook-to-epub3 script using the cli inside a second | ||
# container | ||
|
||
set -e | ||
cd $(dirname "$0") | ||
|
||
# download test DTBook from https://github.com/daisy/pipeline-samples | ||
DATA_DIR=../../../target/test-docker/data | ||
mkdir -p $DATA_DIR | ||
cd $DATA_DIR | ||
DTBOOK=hauy_valid.xml | ||
DATA=$(basename $DTBOOK).zip | ||
rm -f $DATA | ||
for f in \ | ||
$DTBOOK \ | ||
dtbook.2005.basic.css \ | ||
valentin.jpg | ||
do | ||
curl https://raw.githubusercontent.com/daisy/pipeline-samples/10bbb8e/dtbook/$f 2>/dev/null >$f | ||
zip $DATA $f | ||
done | ||
|
||
CLIENTKEY=clientid | ||
CLIENTSECRET=sekret | ||
MOUNT_POINT=/mnt | ||
|
||
# run the pipeline | ||
docker run --name pipeline --detach \ | ||
-e PIPELINE2_WS_HOST=0.0.0.0 \ | ||
-e PIPELINE2_AUTH=true \ | ||
-e PIPELINE2_WS_AUTHENTICATION_KEY=$CLIENTKEY \ | ||
-e PIPELINE2_WS_AUTHENTICATION_SECRET=$CLIENTSECRET \ | ||
-p 8181:8181 daisyorg/pipeline2 | ||
|
||
# wait for the pipeline to start | ||
sleep 5 | ||
while ! curl localhost:8181/ws/alive >/dev/null 2>/dev/null; do | ||
echo "Waiting for web service to be up..." >&2 | ||
sleep 2 | ||
done | ||
|
||
# run the cli | ||
docker run --name cli --rm -it --link pipeline \ | ||
--entrypoint /opt/daisy-pipeline2/cli/dp2 \ | ||
--volume="$(pwd):$MOUNT_POINT:rw" \ | ||
daisyorg/pipeline2 \ | ||
--host http://pipeline \ | ||
--starting false \ | ||
--client_key $CLIENTKEY \ | ||
--client_secret $CLIENTSECRET \ | ||
dtbook-to-epub3 --source $DTBOOK --output $MOUNT_POINT --data $MOUNT_POINT/$DATA --persistent | ||
# help dtbook-to-epub3 | ||
# dtbook-validator --input-dtbook $DTBOOK --output $MOUNT_POINT --data $MOUNT_POINT/$DATA | ||
|
||
docker stop pipeline | ||
docker rm pipeline | ||
|