Antora installation as Docker containers
Folder structure of the antora project
.
├── content
│ ├── build
│ │ └── site (1)
│ ├── package.json (2)
│ └── playbook_0.1.yml (3)
├── docker-compose.yml
└── Dockerfile
| 1 | location where all static files will be located |
| 2 | nodejs project dependencies |
| 3 | exemplary playbook |
package.json
{
"name": "<project name>",
"version": "0.0.1",
"description": "<description>",
"author": "<author>",
"private": true,
"scripts": {
"author": "antora --fetch playbook_0.1.yml",
"build": "antora --fetch playbook_0.1.yml",
"serve": "http-server _site -c-1 -p 80 -a 127.0.0.1"
},
"devDependencies": {
"@antora/cli": "^3.1.4",
"@antora/lunr-extension": "^1.0.0-alpha.8",
"@antora/site-generator": "^3.1.4",
"asciidoctor-highlight.js": "^0.4.0",
"asciidoctor-kroki": "^0.17.0",
"http-server": "^14.1.1"
}
}
Dockerfile
FROM node:18 (1)
RUN apt update \
&& apt install -y nano (2)
COPY ./content/package.json /usr/src/app/content/package.json (3)
WORKDIR /usr/src/app/content (4)
RUN npm install (5)
RUN npm i -g @antora/cli@3.1 @antora/site-generator@3.1 (6)
EXPOSE 80 (7)
CMD [ "node", "server.js" ] (8)
| 1 | Base image |
| 2 | helpfull tools |
| 3 | copy package.json in oder to provide dependencies attributes and some metadata for the installation of nodejs project |
| 4 | defines the working directory of container |
| 5 | installs the package defined in the package.json file |
| 6 | installs antora cli and antora generator |
| 7 | makes the port 80 accessible |
| 8 | run the node server (maybe not neccessary here) |
docker-compose.ym file
version: "3"
services:
antora-generator:
image: antora:3.1
command: npx antora --fetch /antora/playbooks/playbook.yml
volumes:
- antora-site:/antora/build/site
- ./playbooks:/antora/playbooks
antora-web:
image: lighttpd:1.4.73
restart: always
env_file:
- .env
# depends_on:
# - antora-generator
volumes:
- antora-site:/var/www/html:ro
labels:
- traefik.enable=true
- traefik.http.routers.antora.rule=Host(`$SUBDOMAIN.$HOST`)
- traefik.http.routers.antora.tls=true
- traefik.http.routers.antora.tls.certresolver=letsencrypt
- traefik.http.routers.antora.service=antora
- traefik.http.services.antora.loadbalancer.server.port=80
networks:
- public
networks:
public:
external: true
volumes:
antora-site: