deploy with docker nginx

This commit is contained in:
simon 2023-03-21 09:13:00 +07:00
parent 40c2c1ed73
commit b46be0c07f
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
4 changed files with 32 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# ignore test builds
mkdocs/site

17
Dockerfile Normal file
View File

@ -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

View File

@ -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
```

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
mkdocs==1.4.2
mkdocs-material==9.1.3