dita-ot / docs

DITA Open Toolkit documentation
https://www.dita-ot.org/dev
Apache License 2.0
58 stars 96 forks source link

Small proposed changes for Docker image creation #519

Closed raducoravu closed 10 months ago

raducoravu commented 10 months ago

Based on this article: https://www.dita-ot.org/dev/topics/using-docker-images I experimented with creating a Docker image for the Oxygen Publishing Engine: https://blog.oxygenxml.com/topics/creating_a_docker_image_for_the_oxygen_publishing_engine.html

A couple of remarks about the proposed command to run docker in the DITA OT documentation:

$ docker run -it \
  -v /Users/username/source:/src ghcr.io/dita-ot/dita-ot:4.1.2 \
  -i /src/input.ditamap \
  -o /src/out \
  -f html5 -v

Those "-it" flags do not seem useful in this context, also ideally the "--rm" flag would be added to automatically remove the container after it finishes because containers would keep accumulating although they are useless once they produce the output. The "--name dita-ot-publish" param can also be used to give a human readable name to the container.

I started from the DITA OT Dockerfile (so thanks for having it): https://github.com/dita-ot/dita-ot/blob/develop/Dockerfile and I created my equivalent: https://github.com/oxygenxml/blog/blob/master/build/Dockerfile

I made some simplifications by avoiding things like:

mv /tmp/dita-ot-$VERSION/config /opt/app/config && \
mv /tmp/dita-ot-$VERSION/lib /opt/app/lib && \
mv /tmp/dita-ot-$VERSION/plugins /opt/app/plugins && \
mv /tmp/dita-ot-$VERSION/build.xml /opt/app/build.xml && \
mv /tmp/dita-ot-$VERSION/integrator.xml /opt/app/integrator.xml && \

and just moving the entire dita-ot folder to the "/opt/app" subfolder.

infotexture commented 10 months ago

@raducoravu Thanks for these suggestions, and thanks to @jelovirt for implementing the flag changes. 🙇

The "--name dita-ot-publish" param can also be used to give a human readable name to the container. ⋮ I made some simplifications by avoiding things like:

@raducoravu @jelovirt Should we implement those suggestions directly in dita-ot/Dockerfile, or do we need to preserve that as is for backwards compatibility?

jelovirt commented 10 months ago

IMO the --name doesn't need to be added to the examples, because the container will be removed after it exists.

Some changes in the Oxygen DITA-OT Dockerfile may be worth investigating, but it's a matter of coding style and e.g. the docs are not needed in the Docker image.