From b46be0c07f2e335e7b55230bf77cbedfbbf4097d Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 21 Mar 2023 09:13:00 +0700 Subject: [PATCH] deploy with docker nginx --- .gitignore | 2 ++ Dockerfile | 17 +++++++++++++++++ README.md | 11 +++++++++++ requirements.txt | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08f931c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# ignore test builds +mkdocs/site diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a1c1137 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# build the docs and load static files into nginx + +FROM python:3.10.9-slim-bullseye AS builder +ENV PATH=/root/.local/bin:$PATH + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git + +COPY requirements.txt /requirements.txt +RUN pip install --user -r requirements.txt + +RUN git clone https://github.com/tubearchivist/docs.git +WORKDIR docs/mkdocs +RUN mkdocs build + +FROM nginx as srv +COPY --from=builder docs/mkdocs/site /usr/share/nginx/html diff --git a/README.md b/README.md index faf9895..f65b481 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,14 @@ mkdocs serve ``` And the site - with live reload enabled - should be available on [localhost:8000](http://localhost:8000/). + +## Production environment +Build the Docker image: +``` +docker build -t bbilly1/tubearchivist-docs . +``` + +Run the image: +``` +docker run -p 80:80 bbilly1/tubearchivist-docs +``` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2681e52 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +mkdocs==1.4.2 +mkdocs-material==9.1.3