diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6d0d995..89c8ae5 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -97,7 +97,8 @@ Open a terminal at the project root and run the following for to activate all se $ docker compose -f docker-compose.local.yml up -The site should start and be accessible at http://localhost:3000, with the api visible at http://localhost:8000/api. +The site should start and be accessible at http://localhost:3000, with the api visible +at http://localhost:8000/api/ and the documentation at http://localhost:9000. You can also set the environment variable ``COMPOSE_FILE`` pointing to ``docker-compose.local.yml`` like this:: @@ -119,10 +120,6 @@ To run in a detached (background) mode, just:: $ docker compose up -d -These commands don't run the docs service. In order to run docs service you can run:: - - $ docker compose -f docker-compose.docs.yml up - Execute Management Commands --------------------------- diff --git a/compose/local/django/Dockerfile b/compose/local/django/Dockerfile index 09be2e2..941f197 100644 --- a/compose/local/django/Dockerfile +++ b/compose/local/django/Dockerfile @@ -47,6 +47,8 @@ RUN groupadd --gid 1000 dev-user \ # Install required system dependencies RUN apt-get update && apt-get install --no-install-recommends -y \ + # To run the Makefile for docs + make \ # psycopg dependencies libpq-dev \ # Translations dependencies @@ -74,6 +76,10 @@ RUN sed -i 's/\r$//g' /start RUN chmod +x /start +COPY ./compose/local/django/start-docs /start-docs +RUN sed -i 's/\r$//g' /start-docs +RUN chmod +x /start-docs + COPY ./compose/local/django/celery/worker/start /start-celeryworker RUN sed -i 's/\r$//g' /start-celeryworker RUN chmod +x /start-celeryworker diff --git a/compose/local/docs/start b/compose/local/django/start-docs similarity index 89% rename from compose/local/docs/start rename to compose/local/django/start-docs index 96a94f5..f068c7f 100644 --- a/compose/local/docs/start +++ b/compose/local/django/start-docs @@ -4,4 +4,5 @@ set -o errexit set -o pipefail set -o nounset +cd docs/ exec make livehtml diff --git a/compose/local/docs/Dockerfile b/compose/local/docs/Dockerfile deleted file mode 100644 index 9251eff..0000000 --- a/compose/local/docs/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# define an alias for the specific python version used in this file. -FROM docker.io/python:3.12.2-slim-bookworm as python - - -# Python build stage -FROM python as python-build-stage - -ENV PYTHONDONTWRITEBYTECODE 1 - -RUN apt-get update && apt-get install --no-install-recommends -y \ - # dependencies for building Python packages - build-essential \ - # psycopg dependencies - libpq-dev \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# Requirements are installed here to ensure they will be cached. -COPY ./requirements /requirements - -# create python dependency wheels -RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \ - -r /requirements/local.txt -r /requirements/production.txt \ - && rm -rf /requirements - - -# Python 'run' stage -FROM python as python-run-stage - -ARG BUILD_ENVIRONMENT -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 - -RUN apt-get update && apt-get install --no-install-recommends -y \ - # To run the Makefile - make \ - # psycopg dependencies - libpq-dev \ - # Translations dependencies - gettext \ - # Uncomment below lines to enable Sphinx output to latex and pdf - # texlive-latex-recommended \ - # texlive-fonts-recommended \ - # texlive-latex-extra \ - # latexmk \ - # cleaning up unused files - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* - -# copy python dependency wheels from python-build-stage -COPY --from=python-build-stage /usr/src/app/wheels /wheels - -# use wheels to install python dependencies -RUN pip install --no-cache /wheels/* \ - && rm -rf /wheels - -COPY ./compose/local/docs/start /start-docs -RUN sed -i 's/\r$//g' /start-docs -RUN chmod +x /start-docs - -WORKDIR /docs diff --git a/docker-compose.docs.yml b/docker-compose.docs.yml deleted file mode 100644 index 0e2f1d1..0000000 --- a/docker-compose.docs.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: "3.8" - -services: - docs: - image: democrasite_local_docs - container_name: democrasite-local-docs - build: - context: . - dockerfile: ./compose/local/docs/Dockerfile - env_file: - - ./.envs/.local/.django - volumes: - - ./docs:/docs:z - - ./config:/app/config:z - - ./democrasite:/app/democrasite:z - - ./README.rst:/docs/README.rst:z - - ./CONTRIBUTING.rst:/docs/CONTRIBUTING.rst:z - ports: - - "9000:9000" - command: /start-docs diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 4f3f6d7..18df3e5 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -5,7 +5,7 @@ volumes: democrasite_local_postgres_data_backups: {} services: - django: + django: &django build: context: . dockerfile: ./compose/local/django/Dockerfile @@ -38,35 +38,36 @@ services: env_file: - ./.envs/.local/.postgres + docs: + <<: *django + image: democrasite_local_docs + container_name: democrasite-local-docs + volumes: + - .:/app:z + ports: + - "9000:9000" + command: /start-docs + healthcheck: {} + redis: image: docker.io/redis:6 container_name: democrasite-local-redis celeryworker: &celery - build: - context: . - dockerfile: ./compose/local/django/Dockerfile + <<: *django image: democrasite_local_celeryworker container_name: democrasite-local-celeryworker depends_on: - redis - postgres - volumes: - - .:/app:z - env_file: - - ./.envs/.local/.django - - ./.envs/.local/.postgres ports: [] command: /start-celeryworker + healthcheck: {} celerybeat: <<: *celery image: democrasite_local_celerybeat container_name: democrasite-local-celerybeat - depends_on: - - redis - - postgres - ports: [] command: /start-celerybeat flower: diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst deleted file mode 100755 index e69de29..0000000 diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst new file mode 120000 index 0000000..798f2aa --- /dev/null +++ b/docs/CONTRIBUTING.rst @@ -0,0 +1 @@ +../CONTRIBUTING.rst \ No newline at end of file diff --git a/docs/README.rst b/docs/README.rst deleted file mode 100755 index e69de29..0000000 diff --git a/docs/README.rst b/docs/README.rst new file mode 120000 index 0000000..89a0106 --- /dev/null +++ b/docs/README.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file