Redrafted Sphinx for CyMaIS

This commit is contained in:
2025-03-21 13:48:42 +01:00
parent fe85d4bd37
commit c402583f2b
16 changed files with 159 additions and 65 deletions

View File

@@ -1,33 +0,0 @@
ARG DOCKER_PYTHON_VERSION
FROM python:${DOCKER_PYTHON_VERSION}
ARG SPHINX_SOURCE_DIR
ARG SPHINX_BUILD_DIR
ARG SPHINX_EXEC_DIR
ARG SPHINX_APP_DIR
ARG SPHINX_SOURCE_DIR_RELATIVE
# Set the environment variables so they are available during build for Makefile
ENV SPHINX_SOURCE_DIR=${SPHINX_SOURCE_DIR}
ENV SPHINX_BUILD_DIR=${SPHINX_BUILD_DIR}
# Install required packages
RUN apt-get update && apt-get install -y make curl
# Set the working directory
WORKDIR ${SPHINX_APP_DIR}
# Copy the project files into the container
COPY ${SPHINX_SOURCE_DIR_RELATIVE} ${SPHINX_APP_DIR}
# Install Python packages via requirements.txt
RUN cd ${SPHINX_EXEC_DIR} && pip install --upgrade pip && pip install -r requirements.txt
# Build the HTML documentation using Sphinx with the defined directories
RUN cd ${SPHINX_EXEC_DIR} && make html
# Expose port 8000 where the HTTP server will run
EXPOSE 8000
# Start a simple HTTP server to serve the built documentation
CMD python -m http.server 8000 --directory "${SPHINX_BUILD_DIR}html/"

View File

@@ -26,10 +26,10 @@
domain: "{{ domains[application_id] }}"
http_port: "{{ ports.localhost.http[application_id] }}"
- name: "create {{ sphinx_docker_file }}"
- name: "create {{ sphinx_host_dockerfile }}"
copy:
src: "Dockerfile"
dest: "{{ sphinx_docker_file }}"
src: "{{ sphinx_control_node_dockerfile }}"
dest: "{{ sphinx_host_dockerfile }}"
mode: '770'
force: yes
notify: docker compose project build and setup

View File

@@ -4,12 +4,12 @@ services:
context: .
dockerfile: Dockerfile
args:
SPHINX_SOURCE_DIR: {{docker_source_dir}}
SPHINX_BUILD_DIR: {{docker_output_dir}}
SPHINX_EXEC_DIR: {{docker_exec_dir}}
SPHINX_APP_DIR: {{docker_app_dir}}
SPHINX_SOURCE_DIR: {{docker_source_dir}}
SPHINX_OUTPUT_DIR: {{docker_output_dir}}
SPHINX_EXEC_DIR: {{docker_exec_dir}}
SPHINX_DOCKER_EXEC_DIR: {{docker_app_dir}}
SPHINX_SOURCE_DIR_RELATIVE: {{host_sphinx_source_dir_relative}}
DOCKER_PYTHON_VERSION: {{applications[application_id].version}}
DOCKER_PYTHON_VERSION: {{applications[application_id].version}}
ports:
- "127.0.0.1:{{ports.localhost.http[application_id]}}:8000"
healthcheck:

View File

@@ -5,7 +5,8 @@ host_sphinx_source_dir_absolute: "{{docker_compose.directories.instance}}{{host
docker_app_dir: "/app/" # Folder in which the application is running
docker_source_dir: "{{docker_app_dir}}" # Folder which is used to be screened
docker_output_dir: "/docs/" # Folder to which the output is fuuuucking putted!
docker_output_dir: "/output/" # Folder to which the output is fuuuucking putted!
docker_exec_dir: "{{docker_app_dir}}{{applications.sphinx.sphinx_exec_dir_relative}}" # Folder which contains the sphinxs makefile and logic
sphinx_docker_file: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx
sphinx_host_dockerfile: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx
sphinx_control_node_dockerfile: "{{ [ playbook_dir, 'docs/Dockerfile' ] | path_join }}" # Path to the Dockerfile on the control node