The goal is to generate the documentation in the container and to
retrieve the generated files in local.
You use a local directory as source of the mount here : - ./documentation:/doc
.
It will make the /doc
directory on the container to be synchronized with the ./documentation
on the host but the source of the content is the host, not the container.
To get generated files on the host you can use a named volume instead of :
volumes:
- documentation-doxygen:/doc
After the container run you could get more information on that volume (location among other things) with docker volume inspect documentation-doxygen
.
But if you mount the volume only to get the created folder, I think that you don't need to use volume at all.
A straighter alternative is simply doing the copy of the folder on the host after the container run :
docker copy DOC_CONTAINER_ID:/doc ./documentation-doxygen
As another alternative, if you want to execute doxygen Doxyfile
in a local context in terms of folder but in a container (possible way in local env), you could replace RUN
BY CMD
or ENTRYPOINT
to execute it as the container startup command and mount the current directory as a bind mount.
It will spare you some copies in the Dockerfile
.
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y doxygen doxygen-gui doxygen-doc graphviz
WORKDIR /doc
# REMOVE THAT COPY Doxyfile .
# REMOVE THAT COPY logo.png .
ENTRYPOINT doxygen Doxyfile
And the docker-compose part :
version: "3"
services:
doc:
build: ./doc
volumes:
- ./:/doc
Here ./
is specified to use as bind source the base directory of the context of the doc
service.