mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-03-29 04:23:34 +01:00
General Sphinx optimations
This commit is contained in:
parent
2095f16402
commit
985ed797bd
@ -549,9 +549,9 @@ defaults_applications:
|
|||||||
|
|
||||||
## Sphinx
|
## Sphinx
|
||||||
sphinx:
|
sphinx:
|
||||||
version: "3.9-slim" # Use latest docker image
|
version: "3.9-slim" # Use latest docker image
|
||||||
volumes:
|
repository_sphinx_source: "https://github.com/kevinveenbirkenbach/cymais.git" # Repository address to pull the source repository from
|
||||||
source_dir: "{ansible_playbook_dir}" # Path from which sphinx reads the documentation
|
sphinx_exec_dir_relative: "sphinx/" # The relative path to the sphinx Makefile folder from the source dir
|
||||||
|
|
||||||
|
|
||||||
## Taiga
|
## Taiga
|
||||||
|
@ -4,12 +4,19 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: docker-compose
|
name: docker-compose
|
||||||
|
|
||||||
- name: pull cymais repository
|
- name: "Create {{ host_sphinx_source_dir_absolute }} directory"
|
||||||
|
file:
|
||||||
|
path: "{{ host_sphinx_source_dir_absolute }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: pull the source repository to build the Sphinx documentation from {{ applications.sphinx.repository_sphinx_source }}
|
||||||
git:
|
git:
|
||||||
repo: "{{ repository_address_cymais }}"
|
repo: "{{ applications.sphinx.repository_sphinx_source }}"
|
||||||
dest: "{{ host_cymais_volume_dir_absolute }}"
|
dest: "{{ host_sphinx_source_dir_absolute }}"
|
||||||
update: yes
|
update: yes
|
||||||
notify: docker compose project setup
|
clone: yes
|
||||||
|
notify: docker compose project build and setup
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "include role nginx-domain-setup for {{application_id}}"
|
- name: "include role nginx-domain-setup for {{application_id}}"
|
||||||
@ -25,7 +32,7 @@
|
|||||||
dest: "{{ sphinx_docker_file }}"
|
dest: "{{ sphinx_docker_file }}"
|
||||||
mode: '770'
|
mode: '770'
|
||||||
force: yes
|
force: yes
|
||||||
notify: docker compose project setup
|
notify: docker compose project build and setup
|
||||||
|
|
||||||
- name: "copy docker-compose.yml and env file"
|
- name: "copy docker-compose.yml and env file"
|
||||||
include_tasks: copy-docker-compose-and-env.yml
|
include_tasks: copy-docker-compose-and-env.yml
|
@ -1,22 +1,35 @@
|
|||||||
FROM python:{{applications[application_id].version}}
|
FROM python:{{applications[application_id].version}}
|
||||||
|
|
||||||
# Install required packages including 'make'
|
ARG SPHINX_SOURCE_DIR
|
||||||
RUN apt-get update && apt-get install -y make
|
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
|
||||||
|
ENV SPHINX_SOURCE_DIR=${SPHINX_SOURCE_DIR}
|
||||||
|
ENV SPHINX_SOURCE_DIR_RELATIVE=${SPHINX_SOURCE_DIR_RELATIVE}
|
||||||
|
ENV SPHINX_BUILD_DIR=${SPHINX_BUILD_DIR}
|
||||||
|
ENV SPHINX_EXEC_DIR=${SPHINX_EXEC_DIR}
|
||||||
|
ENV SPHINX_APP_DIR=${SPHINX_APP_DIR}
|
||||||
|
|
||||||
|
# Install required packages
|
||||||
|
RUN apt-get update && apt-get install -y make curl
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR {{docker_app_dir}}
|
WORKDIR ${SPHINX_APP_DIR}
|
||||||
|
|
||||||
# Copy the project files into the container
|
# Copy the project files into the container
|
||||||
COPY {{host_cymais_volume_dir_relative}} {{docker_app_dir}}
|
COPY ${SPHINX_SOURCE_DIR_RELATIVE} ${SPHINX_APP_DIR}
|
||||||
|
|
||||||
# Install Python packages via requirements.txt
|
# Install Python packages via requirements.txt
|
||||||
RUN cd {{docker_sphinx_dir}} && pip install --upgrade pip && pip install -r 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
|
# Build the HTML documentation using Sphinx with the defined directories
|
||||||
RUN cd {{docker_sphinx_dir}} && make html
|
RUN cd ${SPHINX_EXEC_DIR} && make html
|
||||||
|
|
||||||
# Expose port 8000 where the HTTP server will run
|
# Expose port 8000 where the HTTP server will run
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Start a simple HTTP server to serve the built documentation
|
# Start a simple HTTP server to serve the built documentation
|
||||||
CMD ["python", "-m", "http.server", "8000", "--directory", "${BUILD_DIR}"]
|
CMD ["python", "-m", "http.server", "8000", "--directory", "${SPHINX_BUILD_DIR}"]
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
services:
|
services:
|
||||||
application:
|
application:
|
||||||
build: .
|
build:
|
||||||
|
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}}
|
||||||
|
SPINX_SOURCE_DIR_RELATIVE: {{host_sphinx_source_dir_relative}}
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:{{ports.localhost.http[application_id]}}:8000"
|
- "127.0.0.1:{{ports.localhost.http[application_id]}}:8000"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@ -8,6 +16,7 @@ services:
|
|||||||
interval: 1m
|
interval: 1m
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
{% include 'roles/docker-compose/templates/services/base.yml.j2' %}
|
||||||
{% include 'templates/docker/container/networks.yml.j2' %}
|
{% include 'templates/docker/container/networks.yml.j2' %}
|
||||||
|
|
||||||
{% include 'templates/docker/compose/networks.yml.j2' %}
|
{% include 'templates/docker/compose/networks.yml.j2' %}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
SOURCE_DIR={{docker_source_dir}}
|
|
||||||
BUILD_DIR={{docker_output_dir}}
|
|
@ -1,13 +1,12 @@
|
|||||||
application_id: "sphinx"
|
application_id: "sphinx"
|
||||||
|
|
||||||
repository_address_cymais: "https://github.com/kevinveenbirkenbach/cymais.git" # Repository address to pull cymais from
|
host_sphinx_source_dir_relative: "volumes/source/" # Place where the sphinx source repository is stored on the host
|
||||||
|
host_sphinx_source_dir_absolute: "{{docker_compose.directories.instance}}{{host_sphinx_source_dir_relative}}" # Place where the sphinx source repository is stored on the host
|
||||||
|
|
||||||
host_cymais_volume_dir_absolute: "{{docker_compose.directories.volumes}}cymais/" # Place where the cymais repository is stored on the host
|
docker_app_dir: "/app/" # Folder in which the application is running
|
||||||
host_cymais_volume_dir_relative: "volumes/cymais/" # Place where the cymais repository is stored on the host
|
docker_source_dir: "{{docker_app_dir}}" # Folder which is used to be screened
|
||||||
|
docker_output_dir: "/docs/"
|
||||||
|
docker_html_output_dir: "{{docker_output_dir}}html/" # 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
|
||||||
|
|
||||||
docker_app_dir: "/app/" # Folder in which the application is running
|
sphinx_docker_file: "{{ docker_compose.directories.instance }}Dockerfile" # Path to the Dockerfile to build sphinx
|
||||||
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_sphinx_dir: "{{docker_app_dir}}/sphinx/" # Folder which contains the sphinxs makefile and logic
|
|
||||||
|
|
||||||
sphinx_docker_file: "{{ docker_compose.directories.instance }}/Dockerfile"
|
|
@ -2,19 +2,19 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# You can set these variables from the command line, and also
|
# You can set these variables from the command line, and also
|
||||||
# from the environment for the first two.
|
# from the environment
|
||||||
SPHINXOPTS ?= -c .
|
SPHINXOPTS ?= -c .
|
||||||
SPHINXBUILD ?= sphinx-build
|
SPHINXBUILD ?= sphinx-build
|
||||||
SOURCE_DIR = ../
|
SPHINX_SOURCE_DIR ?= ../
|
||||||
BUILD_DIR = ../docs
|
SPHINX_BUILD_DIR ?= ../docs
|
||||||
|
|
||||||
# Put it first so that "make" without argument is like "make help".
|
# Put it first so that "make" without argument is like "make help".
|
||||||
help:
|
help:
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCE_DIR)" "$(BUILD_DIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M help "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
.PHONY: help install Makefile
|
.PHONY: help install Makefile
|
||||||
|
|
||||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
%: Makefile
|
%: Makefile
|
||||||
@$(SPHINXBUILD) -M $@ "$(SOURCE_DIR)" "$(BUILD_DIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M $@ "$(SPHINX_SOURCE_DIR)" "$(SPHINX_BUILD_DIR)" $(SPHINXOPTS) $(O)
|
||||||
|
@ -32,7 +32,7 @@ html_sidebars = {
|
|||||||
'**': [
|
'**': [
|
||||||
'globaltoc.html',
|
'globaltoc.html',
|
||||||
'relations.html',
|
'relations.html',
|
||||||
'sourcelink.html',
|
# 'sourcelink.html',
|
||||||
'local_md_files.html', # Include your custom template
|
'local_md_files.html', # Include your custom template
|
||||||
'searchbox.html',
|
'searchbox.html',
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user