mirror of
https://github.com/Mailu/Mailu.git
synced 2025-01-16 02:46:44 +02:00
Merge #1908
1908: Optimize docs/Dockerfile r=mergify[bot] a=Erriez - Convert .rst to .html in temporary `python:3.8-alpine3.14` build image - Remove all unused packages - Use `nginx:1.21-alpine` deployment image ## What type of PR? Optimize/fix `docs/Dockerfile` ## What does this PR do? ### Related issue(s) - Mention an issue like: #1851 ## Prerequistes Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [ ] In case of feature or enhancement: documentation updated accordingly - [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file. ## Testing The following tests has been executed locally: ```bash export DOCKER_ORG=user export DOCKER_PREFIX= export MAILU_VERSION=master cd tests time docker-compose -f build.yml build --no-cache docs real 0m18.850s user 0m0.317s sys 0m0.124s docker images REPOSITORY TAG IMAGE ID CREATED SIZE user/docs master 3de6c8612cf3 19 seconds ago 38.1MB docker run -it --rm --name mailu-docs -p 80:80 user/docs:master Open web browser: Clear caches http://localhost:80/master ``` Co-authored-by: Erriez <Erriez@users.noreply.github.com>
This commit is contained in:
commit
bfb2665d58
@ -1,19 +1,28 @@
|
||||
ARG DISTRO=python:3.8-alpine3.14
|
||||
FROM $DISTRO
|
||||
|
||||
COPY requirements.txt /requirements.txt
|
||||
# Convert .rst files to .html in temporary build container
|
||||
FROM python:3.8-alpine3.14 AS build
|
||||
|
||||
ARG version=master
|
||||
ENV VERSION=$version
|
||||
|
||||
RUN apk add --no-cache nginx curl \
|
||||
&& pip3 install -r /requirements.txt
|
||||
|
||||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY requirements.txt /requirements.txt
|
||||
COPY . /docs
|
||||
|
||||
RUN mkdir -p /build/$VERSION \
|
||||
&& sphinx-build -W /docs /build/$VERSION
|
||||
RUN apk add --no-cache --virtual .build-deps \
|
||||
gcc musl-dev \
|
||||
&& pip3 install -r /requirements.txt \
|
||||
&& mkdir -p /build/$VERSION \
|
||||
&& sphinx-build -W /docs /build/$VERSION \
|
||||
&& apk del .build-deps
|
||||
|
||||
|
||||
# Build nginx deployment image including generated html
|
||||
FROM nginx:1.21-alpine
|
||||
|
||||
ARG version=master
|
||||
ENV VERSION=$version
|
||||
|
||||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /build/$VERSION /build/$VERSION
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user