diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..eb5a316cbd195d26e3f768c7dd8e1b47299e17f8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a85cd3d32dfc112095b2d9e8893151ea33146832 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# use an old version of Ruby +FROM ruby:2.3.1 as builder + +USER root +# non interactive +ARG DEBIAN_FRONTEND=noninteractive +# install utilities (gcc, ...) +RUN apt-get update && apt-get install -y \ + wget curl sudo build-essential git git-svn \ + && rm -rf /var/lib/apt/lists/* + +# for gem dependencies +RUN mkdir -p /opt/jekyll-gazelle-documentation +WORKDIR /opt/jekyll-gazelle-documentation +# copy only Gemfile/Gemfile.lock +COPY _templates/jekyll-gazelle-documentation/Gemfile* /opt/jekyll-gazelle-documentation/ +# install bundler with version specified in Gemfile.lock +RUN gem install bundler -v 1.17.3 +# install gem dependencies provided in Gemfile.lock +RUN bundle install --deployment + +# copy all directory to /opt/gazelle-user-documentation +RUN mkdir -p /opt/gazelle-user-documentation +COPY . /opt/gazelle-user-documentation/ +WORKDIR /opt/gazelle-user-documentation/ + +# build jekyll website +RUN make jekyll + +# simple webserver +FROM nginx:latest +# html location +RUN mkdir -p /usr/share/nginx/html/gazelle-documentation +# copy jekyll website +COPY --from=builder /opt/gazelle-user-documentation/target/jekyll-gazelle-documentation/_site /usr/share/nginx/html/gazelle-documentation/ +# create an index.html +RUN cp /usr/share/nginx/html/gazelle-documentation/index-default.html /usr/share/nginx/html/gazelle-documentation/index.html diff --git a/README.md b/README.md index 724a3b951817e5e590f04548fe6e8d8ecb8a8a5e..3d7469895d39783bfb29d3d592d26bc54c2fdbd1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,20 @@ Generate gazelle framework documentation from markdown files. This project generates pdf, pdf with revision marks and a static website (using jekyll). +## Build and preview website with Docker + +It requires Docker and docker-compose installed. + +No local Ruby, Pandoc, tex, ... are required. + +To update website and serve it : + +```bash +docker-compose up --build +``` + +Document is then available at <http://localhost:1080/gazelle-documentation/> + ## Requirements sudo apt-get install make git git-svn texlive-xetex pandoc ruby-dev diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..0e92de746ed6d9773da59d1d3fb6bccf703221a6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3.9" +services: + gazelle-documentation: + build: + context: . + dockerfile: Dockerfile + ports: + - "127.0.0.1:1080:80"