Skip to content

Commit 4a699e0

Browse files
committed
feat: add local preview with Docker
Add a Dockerfile and a docker-compose.yml to be able to quickly preview the document locally using the template at https://github.com/italia/docs-italia-template.
1 parent a91e567 commit 4a699e0

7 files changed

+88
-6
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
html/
22
.venv
3-
.vscode
3+
.vscode
4+
_build

Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.8
2+
3+
WORKDIR /app
4+
5+
COPY preview_build/requirements.txt requirements.txt
6+
7+
RUN pip3 install -r requirements.txt
8+
9+
EXPOSE 8000
10+
11+
CMD [ "sphinx-autobuild", ".", "_build", "--host", "0.0.0.0"]

README.md

+26-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,32 @@ Le funzioni di hosting e di ricerca sono basate su [ReadTheDocs](https://readthe
4545

4646
Tutti i documenti di *Docs Italia* possono essere fruiti anche in formato .epub e .pdf
4747

48-
## Compilazione della documentazione
49-
I file contenuti in questo repository possono essere modificati sul proprio computer ed essere convertiti in formato HTML per validarne i cambiamenti. È necessario innanzitutto installare il tema di Docs Italia attraverso il seguente comando:
5048

51-
`pip install -r requirements.txt`
49+
## Dipendenze
5250

53-
Quindi lanciare il comando [Sphinx](http://www.sphinx-doc.org) per validare e generare la documentazione, che sarà consultabile all'indirizzo `./html/index.html`:
51+
Il repository è strutturato per essere compatibile con [Docs Italia](https://docs.italia.it/).
52+
La piattaforma accetta documenti in formato RST o MD.
53+
Per informazioni sulla struttura di questo repository visita il [repository
54+
dedicato](https://github.com/italia/docs-italia-starter-kit).
5455

55-
`sphinx-build -n -W -T -b html . html`
56+
## Preview
57+
58+
Per lavorare utilizzando una preview del documento è sufficiente lanciare Docker
59+
60+
```shell
61+
docker-compose up
62+
```
63+
64+
la preview sarà visibile all'indirizzo [http://localhost:8000/](http://localhost:8000/)
65+
66+
## Come contribuire
67+
68+
Ogni contributo è benvenuto!
69+
È possibile aprire delle issue per segnalare errori, problemi o per la
70+
richiesta di nuove funzionalità.
71+
Inoltre, è possibile aprire delle Pull Request per proporre direttamente delle
72+
modifiche.
73+
74+
## Licenza
75+
76+
Questo documento è rilasciato con una licenza CC BY 4.0.

docker-compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3.5"
2+
services:
3+
web:
4+
build: .
5+
volumes:
6+
- .:/app
7+
- /app/preview_build/
8+
- ./preview_build/preview_configuration.py:/app/conf.py
9+
ports:
10+
- "8000:8000"

preview_build/build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
rm -rf ./build && \
4+
cp ./preview_configuration.py ./conf.py && \
5+
sphinx-build .. build -c .
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Sphinx RTD theme demo documentation build configuration file, created by
4+
# sphinx-quickstart on Sun Nov 3 11:56:36 2013.
5+
#
6+
# This file is execfile()d with the current directory set to its containing dir.
7+
#
8+
# Note that not all possible configuration values are present in this
9+
# autogenerated file.
10+
#
11+
# All configuration values have a default; values that are commented out
12+
# serve to show the default.
13+
14+
import sys, os
15+
import docs_italia_theme
16+
17+
from os.path import abspath, join, dirname
18+
19+
extensions = [
20+
'sphinx.ext.autodoc',
21+
'sphinx.ext.viewcode',
22+
'sphinx.ext.doctest',
23+
'docs_italia_theme',
24+
]
25+
26+
# The theme to use for HTML and HTML Help pages. See the documentation for
27+
# a list of builtin themes.
28+
html_theme = 'docs_italia_theme'
29+
30+
# Add any paths that contain custom themes here, relative to this directory.
31+
html_theme_path = [docs_italia_theme.get_html_theme_path()]

preview_build/requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Sphinx==3.4.3
2+
sphinx-autobuild==2020.9.1
3+
docs-italia-theme @ git+https://github.com/italia/docs-italia-theme.git

0 commit comments

Comments
 (0)