26 lines
1.1 KiB
Docker
26 lines
1.1 KiB
Docker
FROM python:3.12-slim AS builder
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends git ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY . .
|
|
|
|
ARG GITHUB_TOKEN=""
|
|
RUN if [ -n "$GITHUB_TOKEN" ]; then \
|
|
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"; \
|
|
fi \
|
|
&& mkdocs build --strict --site-dir /site
|
|
|
|
FROM nginx:1.27-alpine
|
|
|
|
COPY --from=builder /site /usr/share/nginx/html
|
|
|
|
RUN printf 'server {\n listen 80 default_server;\n listen [::]:80 default_server;\n root /usr/share/nginx/html;\n index index.html;\n location / { try_files $uri $uri/ $uri.html =404; }\n location ~* \\.(js|css|woff2?|svg|png|jpg|jpeg|gif|ico)$ { expires 7d; access_log off; }\n gzip on;\n gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;\n gzip_min_length 1024;\n}\n' > /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|