在Docker容器中构buildsphinx文档

我有一个在Docker容器中运行的Flask项目。 我设法build立我的应用程序并成功运行它。 不过,我也想build立狮身人面像文件,所以它的静态文件可以送达。 文档通常使用docs/文件中的make html构build。 我已经find了sphinx的docker源代码,并且已经build立了一个成功运行的docker-composeconfiguration,但是我不能将make html命令传递给sphinx – 我相信因为我正在运行命令,因为make html需要在docs/内运行,而不是从基本目录内运行。

我尝试构buildsphinx文档时出现以下错误:

 docker-compose run --rm sphinx make html Starting web_project Pulling sphinx (nickjer/docker-sphinx:latest)... latest: Pulling from nickjer/docker-sphinx c62795f78da9: Pull complete d4fceeeb758e: Pull complete 5c9125a401ae: Pull complete 0062f774e994: Pull complete 6b33fd031fac: Pull complete aac5b231ab1e: Pull complete 97be0ae484bc: Pull complete ec7c8cca5e46: Pull complete 82cc981959eb: Pull complete 151a33a826a1: Pull complete Digest: sha256:8125ca919069235278a5da631c002926cc57d741fa041b59c758183ebd48121f Status: Downloaded newer image for nickjer/docker-sphinx:latest make: *** No rule to make target 'html'. Stop. 

我的项目有以下目录结构

 docs/ web/ Dockerfile run.py requirements.txt .... docker-compose.yml README.md 

下面的docker-composeconfiguration

 version: '2' services: web: restart: always build: ./web ports: - "7000:7000" environment: DEBUG: 'true' command: /usr/local/bin/gunicorn -w 2 -b :7000 run:app sphinx: image: "nickjer/docker-sphinx" volumes: - "${PWD}:/docs" user: "1000:1000" depends_on: - web 

如何在Docker容器中构build我的狮身人面像文档? 我是否需要将另一个Dockerconfig文件添加到我的docs模块?

我相信因为我运行的命令升级,因为使html需要从docs /而不是从基本目录内运行。

为了testing这个理论,你可以尝试一下这个命令吗?

docker-compose run --rm sphinx bash -c "cd docs; make html"

或者可能

docker-compose exec sphinx bash -c "cd docs; make html"