-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.prod
42 lines (31 loc) · 1.24 KB
/
Dockerfile.prod
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
# This file is used if building for Production environments
# It uses a multi-stage build to run mkdocs to populate an nginx container
FROM python:3.11 AS build
# Add Gem build requirements
RUN apt-get update && apt-get install -y \
g++ \
make \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Add pip requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy Site Files
COPY . .
# Run mkdocs build
RUN mkdocs build
#-------------------------------------------------
# https://github.com/nginxinc/docker-nginx-unprivileged
FROM nginxinc/nginx-unprivileged:stable-alpine AS webserver
RUN sed -Ei'' 's/#error_page *404 +.*/error_page 404 \/404.html;/' /etc/nginx/conf.d/default.conf || true
RUN echo "absolute_redirect off;" >/etc/nginx/conf.d/no-absolute_redirect.conf
RUN echo "gzip_static on; gzip_proxied any;" >/etc/nginx/conf.d/gzip_static.conf
# brotli_static not yet available in standard nginx distribution
# RUN echo "brotli_static on; brotli_proxied any;" >/etc/nginx/conf.d/brotli_static.conf
# Copy built site from build stage
COPY --from=build /app/site /usr/share/nginx/html
# Test configuration during docker build
RUN nginx -t
# Port the container will listen on
EXPOSE 8080