-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.Dockerfile
58 lines (41 loc) · 1.01 KB
/
docs.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## Build & serve mkdocs
FROM python:3.11-slim AS base
## Set ENV variables to control Python/pip behavior inside container
ENV PYTHONDONTWRITEBYTECODE 1 \
PYTHONUNBUFFERED 1 \
## Pip
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100
FROM base AS build
WORKDIR /app
COPY docs/requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY mkdocs.yml /app/mkdocs.yml
COPY ./src /app/src
COPY ./docs /app/docs
FROM build AS docs-build
WORKDIR /app
COPY --from=build /app /app
RUN python -m mkdocs build
FROM nginx:alpine AS docs-serve
COPY --from=docs-build /app/site /use/share/nginx/html
RUN cat <<EOF > /etc/nginx/nginx.conf
events {
worker_connections 1024;
}
http {
include mime.types;
sendfile on;
server {
listen 8000;
listen [::]:8000;
resolver 127.0.0.11;
autoindex off;
server_name _;
server_tokens off;
root /use/share/nginx/html;
gzip_static on;
}
}
EOF