# Stage 1:
-# - Get Shaarli sources
+# - Copy Shaarli sources
+# - Build documentation
+FROM python:3-alpine as docs
+ADD . /usr/src/app/shaarli
+RUN cd /usr/src/app/shaarli \
+ && pip install --no-cache-dir mkdocs \
+ && mkdocs build
+
+# Stage 2:
# - Resolve PHP dependencies with Composer
FROM composer:latest as composer
-RUN curl -L https://github.com/shaarli/Shaarli/archive/master.tar.gz | tar xzf - \
- && mv Shaarli-master shaarli \
- && cd shaarli \
+COPY --from=docs /usr/src/app/shaarli /app/shaarli
+RUN cd shaarli \
&& composer --prefer-dist --no-dev install
-# Stage 2:
+# Stage 3:
# - Frontend dependencies
FROM node:9.9-alpine as node
COPY --from=composer /app/shaarli shaarli
&& yarn run build \
&& rm -rf node_modules
-# Stage 3:
+# Stage 4:
# - Shaarli image
FROM alpine:3.6
LABEL maintainer="Shaarli Community"
php7-zlib \
s6
-COPY nginx.conf /etc/nginx/nginx.conf
-COPY php-fpm.conf /etc/php7/php-fpm.conf
-COPY services.d /etc/services.d
+COPY .docker/nginx.conf /etc/nginx/nginx.conf
+COPY .docker/php-fpm.conf /etc/php7/php-fpm.conf
+COPY .docker/services.d /etc/services.d
RUN rm -rf /etc/php7/php-fpm.d/www.conf \
&& sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php7/php.ini \