Skip to content

Commit

Permalink
feat: add a dockerfile and readme documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
novalagung authored and rdeltour committed Jan 11, 2023
1 parent 0759a82 commit d0ed6a4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# build the epubcheck.jar file
FROM maven:slim as builder

WORKDIR /app
COPY . .
RUN mvn clean install

# prepare runner for epubcheck.jar execution
FROM openjdk:slim

WORKDIR /app
COPY --from=builder /app .
RUN echo '#!/bin/bash\n java -jar /app/target/epubcheck.jar "${@:1}"\n' > entrypoint.sh
RUN chmod +x entrypoint.sh

ENV DATA_PATH=/data
WORKDIR ${DATA_PATH}
VOLUME ${DATA_PATH}

ENTRYPOINT [ "/app/entrypoint.sh" ]
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Historical archives of discussions prior to October 2017 are stored at the old [

## Building EPUBCheck

### Build from sources

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.

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

### Build using docker

To build the epubcheck using docker, use the build command below:

```bash
$ docker build . -t epubcheck
```

To run the epubcheck image as container, use example command below:

```bash
# one directory in the host need to be mapped (using docker volume) to /data path
# within container. the particular path will be used as a bridge to enable access
# over the epub file or the generated output file between host and container.
$ docker run -it --rm -v <directory>:/data epubcheck --help
$ docker run -it --rm -v <directory>:/data epubcheck --help <epub-file> [OPTIONS]

# example 1:
# execute an epub check over a file located in /home/username/file.epub on the host.
# the output will be printed to the console
$ docker run -it --rm -v /home/username:/data epubcheck file.epub --out -

# example 2:
# execute an epub check over a file, and then generate an output file
# in /data/output.json within container.
# since /data is mapped via volume, then the generated file will be accessible
# from /home/username/output.json in the host
$ docker run - --rm -v /home/username:/data epubcheck file.epub --mode opf --profile dict --json output.json
```

## Credits

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/).
Expand Down

0 comments on commit d0ed6a4

Please sign in to comment.