Sphinx Docker Deployment

Viewed 54

I'm trying to create documentation website with docker-compose. I followed this tutorial. In local, I can run it successfully but when I try run container in server it returns me this error:

docs_1     | 2022-09-06T14:34:44.430819779Z [sphinx-autobuild] > sphinx-build -b html /etc/Sphinx/source /etc/Sphinx/build
docs_1     | 2022-09-06T14:34:44.807214119Z 
docs_1     | 2022-09-06T14:34:44.807251454Z Application error:
docs_1     | 2022-09-06T14:34:44.807257159Z Cannot find source directory (/etc/Sphinx/source)
docs_1     | 2022-09-06T14:34:44.867591050Z Command exited with exit code: 2
docs_1     | 2022-09-06T14:34:44.867628073Z The server will continue serving the build folder, but the contents being served are no longer in sync with the documentation sources. Please fix the cause of the error above or press Ctrl+C to stop the server.

Here is my Dockerfile

FROM alpine:latest
WORKDIR /etc/
RUN mkdir -p /etc/Sphinx/build

RUN apk add --no-cache python3 py3-pip make git
RUN pip install git+https://github.com/sphinx-doc/sphinx && \
    pip install sphinx-autobuild

CMD sphinx-autobuild -b html --host 0.0.0.0 --port 80 /etc/Sphinx/source /etc/Sphinx/build
COPY /doc/ /etc/Sphinx/source

And my docker-compose.yml

version: "3.0"
services:
  docs:
    image: registry.digitalocean.com/my_username/${IMAGE}
    container_name: docs
    build: .docker
    volumes:
        - ./doc:/etc/Sphinx/source
    ports:
      - 8100:80

And this is the docker-compose.yml in the server:

docs:
  image: registry.digitalocean.com/my_username/docs
  restart: unless-stopped
  ports:
    - 8100:80

My folder structure is:

docs/
├─ .docker/
│  ├─ dev.env
│  ├─ Dockerfile
│  ├─ prod.env
├─ doc/
│  ├─ conf.py
│  ├─ index.rst
│  ├─ getting_started.rst
├─ docker-compose.yml
├─ README.md

I tried to copy files in doc folder to /etc/Sphinx/source but it returns me this error:

failed to compute cache key: "/doc" not found: not found

Any help will be appreciated, thanks.

0 Answers
Related