Skip to content

Commit d0ed6a4

Browse files
novalagungrdeltour
authored andcommitted
feat: add a dockerfile and readme documentation
1 parent 0759a82 commit d0ed6a4

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# build the epubcheck.jar file
2+
FROM maven:slim as builder
3+
4+
WORKDIR /app
5+
COPY . .
6+
RUN mvn clean install
7+
8+
# prepare runner for epubcheck.jar execution
9+
FROM openjdk:slim
10+
11+
WORKDIR /app
12+
COPY --from=builder /app .
13+
RUN echo '#!/bin/bash\n java -jar /app/target/epubcheck.jar "${@:1}"\n' > entrypoint.sh
14+
RUN chmod +x entrypoint.sh
15+
16+
ENV DATA_PATH=/data
17+
WORKDIR ${DATA_PATH}
18+
VOLUME ${DATA_PATH}
19+
20+
ENTRYPOINT [ "/app/entrypoint.sh" ]

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Historical archives of discussions prior to October 2017 are stored at the old [
3535

3636
## Building EPUBCheck
3737

38+
### Build from sources
39+
3840
To build epubcheck from the sources you need Java Development Kit (JDK) 1.7 or above and [Apache Maven](http://maven.apache.org/) 3.0 or above installed.
3941

4042
Build and run tests:
@@ -44,6 +46,36 @@ $ mvn clean install
4446
```
4547
Will copy `*.jar` files and packages to `target/` folder...
4648

49+
### Build using docker
50+
51+
To build the epubcheck using docker, use the build command below:
52+
53+
```bash
54+
$ docker build . -t epubcheck
55+
```
56+
57+
To run the epubcheck image as container, use example command below:
58+
59+
```bash
60+
# one directory in the host need to be mapped (using docker volume) to /data path
61+
# within container. the particular path will be used as a bridge to enable access
62+
# over the epub file or the generated output file between host and container.
63+
$ docker run -it --rm -v <directory>:/data epubcheck --help
64+
$ docker run -it --rm -v <directory>:/data epubcheck --help <epub-file> [OPTIONS]
65+
66+
# example 1:
67+
# execute an epub check over a file located in /home/username/file.epub on the host.
68+
# the output will be printed to the console
69+
$ docker run -it --rm -v /home/username:/data epubcheck file.epub --out -
70+
71+
# example 2:
72+
# execute an epub check over a file, and then generate an output file
73+
# in /data/output.json within container.
74+
# since /data is mapped via volume, then the generated file will be accessible
75+
# from /home/username/output.json in the host
76+
$ docker run - --rm -v /home/username:/data epubcheck file.epub --mode opf --profile dict --json output.json
77+
```
78+
4779
## Credits
4880

4981
Most of the EPUBCheck functionality comes from the schema validation tool [Jing](http://www.thaiopensource.com/relaxng/jing.html) and schemas that were developed by [IDPF](http://www.idpf.org/) and [DAISY](http://www.daisy.org/). Initial EPUBCheck development was largely done at [Adobe Systems](http://www.adobe.com/).

0 commit comments

Comments
 (0)