├── .gitignore ├── rest.png ├── webapp.png ├── .idea ├── encodings.xml ├── vcs.xml ├── modules.xml ├── docker-image-jodconverer.iml ├── bashsupport_project.xml └── misc.xml ├── bin └── docker-entrypoint.sh ├── makefile ├── LICENSE ├── Dockerfile ├── .github └── workflows │ └── build.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/workspace.xml 2 | .idea/php.xml 3 | -------------------------------------------------------------------------------- /rest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodconverter/docker-image-jodconverter-examples/HEAD/rest.png -------------------------------------------------------------------------------- /webapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jodconverter/docker-image-jodconverter-examples/HEAD/webapp.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/docker-image-jodconverer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/bashsupport_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /bin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ "$1" = "java" ]; then 3 | # the case where the user uses his own java -jar startup command - let him do that 4 | exec gosu jodconverter "$@" > >(tee -a ${LOG_BASE_DIR}/app.log) 2> >(tee -a ${LOG_BASE_DIR}/app.err >&2) 5 | elif [ "$1" = "./gradlew" ]; then 6 | exec "$@" 7 | else 8 | exec gosu jodconverter java -jar ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME} "$@" > >(tee -a ${LOG_BASE_DIR}/app.log) 2> >(tee -a ${LOG_BASE_DIR}/app.err >&2) 9 | fi 10 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build --build-arg BASE_VERSION=0.0.1 --target gui . -t ghcr.io/jodconverter/jodconverter-examples:gui 3 | docker build --build-arg BASE_VERSION=0.0.1 --target rest . -t ghcr.io/jodconverter/jodconverter-examples:rest 4 | 5 | start-gui: stop 6 | docker run --name jodconverter-gui -m 512m --rm -p 8080:8080 ghcr.io/jodconverter/jodconverter-examples:gui 7 | 8 | start-rest: stop 9 | docker run --name jodconverter-rest -m 512m --rm -p 8080:8080 ghcr.io/jodconverter/jodconverter-examples:rest 10 | 11 | stop: 12 | docker stop --name jodconverter-rest > /dev/null 2>&1 || true 13 | docker stop --name jodconverter-spring > /dev/null 2>&1 || true 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Eugen Mayer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_VERSION 2 | # ---------------------------------- Base image 3 | FROM ghcr.io/jodconverter/jodconverter-runtime:$BASE_VERSION as jodconverter-app-base 4 | ENV JAR_FILE_NAME=app.war 5 | ENV JAR_FILE_BASEDIR=/opt/app 6 | ENV LOG_BASE_DIR=/var/log 7 | ENV NONPRIVUSER=jodconverter 8 | ENV NONPRIVGROUP=jodconverter 9 | 10 | COPY ./bin/docker-entrypoint.sh /docker-entrypoint.sh 11 | 12 | RUN mkdir -p ${JAR_FILE_BASEDIR} /etc/app \ 13 | && touch /etc/app/application.properties /var/log/app.log /var/log/app.err \ 14 | && chmod +x /docker-entrypoint.sh \ 15 | && chown $NONPRIVUSER:$NONPRIVGROUP /var/log/app.log /var/log/app.err 16 | 17 | 18 | ENTRYPOINT ["/docker-entrypoint.sh"] 19 | CMD ["--spring.config.additional-location=optional:/etc/app/"] 20 | 21 | # ---------------------------------- build our jodconvert builder, so source code with build tools 22 | FROM bellsoft/liberica-openjdk-debian:17 as builder 23 | RUN apt-get update \ 24 | && apt-get -y install git \ 25 | && git clone https://github.com/jodconverter/jodconverter-samples /tmp/jodconverter-samples \ 26 | ## fixing https://github.com/jodconverter/jodconverter-samples/issues/2 27 | && chmod +x /tmp/jodconverter-samples/gradlew \ 28 | && mkdir /dist 29 | 30 | # ---------------------------------- gui builder 31 | FROM builder as jodconverter-build-gui 32 | WORKDIR /tmp/jodconverter-samples 33 | RUN ./gradlew -x test :samples:spring-boot-webapp:build \ 34 | && cp samples/spring-boot-webapp/build/libs/spring-boot-webapp.war /dist/jodconverter-gui.war 35 | 36 | 37 | # ---------------------------------- rest build 38 | FROM builder as jodconverter-build-rest 39 | WORKDIR /tmp/jodconverter-samples 40 | RUN ./gradlew -x test :samples:spring-boot-rest:build \ 41 | && cp samples/spring-boot-rest/build/libs/spring-boot-rest.war /dist/jodconverter-rest.war 42 | 43 | 44 | # ---------------------------------- GUI prod image 45 | FROM jodconverter-app-base as gui 46 | COPY --from=jodconverter-build-gui /dist/jodconverter-gui.war ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME} 47 | 48 | # ---------------------------------- REST prod image 49 | FROM jodconverter-app-base as rest 50 | COPY --from=jodconverter-build-rest /dist/jodconverter-rest.war ${JAR_FILE_BASEDIR}/${JAR_FILE_NAME} 51 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: docker 2 | 3 | on: 4 | push: 5 | 6 | env: 7 | IMAGE_FQDN: ghcr.io/jodconverter/jodconverter-examples 8 | BASE_VERSION: 0.4.1 9 | 10 | jobs: 11 | docker: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | - name: Set up QEMU 17 | uses: docker/setup-qemu-action@v2 18 | - name: Set up Docker Buildx 19 | uses: docker/setup-buildx-action@v2 20 | - name: Login to GHCR 21 | uses: docker/login-action@v2 22 | with: 23 | registry: ghcr.io 24 | username: ${{ github.repository_owner }} 25 | password: ${{ github.token }} 26 | - name: Build gui 27 | uses: docker/build-push-action@v3 28 | with: 29 | context: . 30 | platforms: linux/amd64 31 | push: false 32 | target: gui 33 | build-args: | 34 | BASE_VERSION=${{ env.BASE_VERSION }} 35 | tags: | 36 | ${{ env.IMAGE_FQDN }}:gui 37 | - name: Build rest 38 | uses: docker/build-push-action@v3 39 | with: 40 | context: . 41 | platforms: linux/amd64 42 | push: false 43 | target: rest 44 | build-args: | 45 | BASE_VERSION=${{ env.BASE_VERSION }} 46 | tags: | 47 | ${{ env.IMAGE_FQDN }}:rest 48 | - name: Push REST 49 | uses: docker/build-push-action@v3 50 | if: startsWith(github.ref, 'refs/tags/') 51 | with: 52 | context: . 53 | platforms: linux/amd64 54 | target: rest 55 | build-args: | 56 | BASE_VERSION=${{ env.BASE_VERSION }} 57 | push: true 58 | tags: | 59 | ${{ env.IMAGE_FQDN }}:rest 60 | ${{ env.IMAGE_FQDN }}:rest-${{ github.ref_name }} 61 | - name: Push GUI 62 | uses: docker/build-push-action@v3 63 | if: startsWith(github.ref, 'refs/tags/') 64 | with: 65 | context: . 66 | platforms: linux/amd64 67 | target: gui 68 | build-args: | 69 | BASE_VERSION=${{ env.BASE_VERSION }} 70 | push: true 71 | tags: | 72 | ${{ env.IMAGE_FQDN }}:gui 73 | ${{ env.IMAGE_FQDN }}:gui-${{ github.ref_name }} 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![build-and-push](https://github.com/jodconverter/docker-image-jodconverter-examples/actions/workflows/build.yml/badge.svg)](https://github.com/jodconverter/docker-image-jodconverter-examples/actions/workflows/build.yml) 2 | 3 | **Hint:** This project has moved from [eugenmayer/docker-image-jodconverter](https://github.com/eugenmayer/docker-image-jodconverter) to [jodconverter/docker-image-jodconverter-examples](https://github.com/jodconverter/docker-image-jodconverter-examples) 4 | since it is just the better home for obvious reasons :) 5 | 6 | ## Wat 7 | 8 | Utilizes the example java projects of [JODconverter](https://github.com/jodconverter/jodconverter) to offer running examples within docker, e.g. to run JODconverter as a REST conversion GUI. 9 | 10 | Other projects: 11 | - The examples here are based on the [jodconverter-runtime](https://github.com/jodconverter/docker-image-jodconverter-runtime) docker image 12 | - office conversion, production leaning - see [eugenmayer/officeconverter](https://github.com/EugenMayer/officeconverter). 13 | 14 | ## Run examples 15 | 16 | That's the variant with a web-GUI (see screenshot) 17 | 18 | docker run --memory 512m --rm -p 8080:8080 ghcr.io/jodconverter/jodconverter-examples:gui 19 | 20 | Now you can connect to http://localhost:8080 with a nice web-ui for conversion 21 | 22 | ![Screenshot](https://github.com/jodconverter/docker-image-jodconverter/blob/main/webapp.png) 23 | 24 | Or you pick the variant a REST interface only 25 | 26 | docker run --memory 512m --rm -p 8080:8080 ghcr.io/jodconverter/jodconverter-examples:rest 27 | 28 | ![Screenshot](https://github.com/jodconverter/docker-image-jodconverter/blob/main/rest.png) 29 | 30 | For more please check the wiki at https://github.com/jodconverter/jodconverter 31 | 32 | ## Docker images 33 | 34 | - `ghcr.io/jodconverter/jodconverter-rutime` - OpenJDK 17: libreoffice included, also start scripts but now actual applications 35 | - `ghcr.io/jodconverter/jodconverter-examples:gui` - OpenJDK 17: the WebGUI, spring based converter 36 | - `ghcr.io/jodconverter/jodconverter-examples:rest` - OpenJDK 17: rest only variant 37 | 38 | ### Configuration 39 | 40 | You can configure the docker images by mounting `/etc/app/application.properties` and put whatever you like into them. 41 | 42 | For example if you like to have 2 LibreOffice instances, you would put into the file 43 | 44 | ```properties 45 | # amount of libreOffice instances to start - one for each given port. So this means 2 46 | jodconverter.local.port-numbers: 2002, 2003 47 | # change the tmp folder 48 | jodconverter.local.working-dir: /tmp 49 | # change upload sizes 50 | spring.servlet.multipart.max-file-size: 5MB 51 | spring.servlet.multipart.max-request-size: 5MB 52 | # change the server port (where the REST app is listenting 53 | server.port=8090 54 | ``` 55 | 56 | ## Build youerself 57 | 58 | make build 59 | make start-gui 60 | # or 61 | make start-rest 62 | 63 | now see above under "Run" how to access it 64 | 65 | ## Credits 66 | 67 | All of those please forward to [sbraconnier's jodconverter](https://github.com/jodconverter/jodconverter) - he does the real work :) 68 | --------------------------------------------------------------------------------