#376 use multi-stage Docker build

This commit is contained in:
Dominik Liebler 2020-04-03 13:56:33 +02:00
parent d0ba13b686
commit be66dcc037
3 changed files with 17 additions and 20 deletions

View File

@ -1,9 +1,17 @@
FROM php:7.3.8-cli
FROM composer AS composer
WORKDIR /app
RUN apt-get update \
&& apt-get install -y libzip-dev wget git-core python3 python3-pip \
&& docker-php-ext-install zip \
&& pip3 install Sphinx sphinx_rtd_theme
ADD . /app
RUN cd /app && make cs test html
CMD [ "php", "-S", "0.0.0.0:80", "-t", "_build/html" ]
RUN composer install \
&& ./vendor/bin/phpcs . \
&& ./vendor/bin/phpunit
FROM python AS sphinx_build
WORKDIR /app
COPY --from=composer /app /app
RUN pip3 install Sphinx sphinx_rtd_theme
RUN make html
FROM nginx
WORKDIR /usr/share/nginx/html
COPY --from=sphinx_build /app/_build/html /usr/share/nginx/html
RUN rm index.html && mv README.html index.html

View File

@ -190,14 +190,3 @@ pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
install: vendor
vendor:
composer install
cs: install
./vendor/bin/phpcs .
test: install
./vendor/bin/phpunit

View File

@ -1,7 +1,7 @@
version: "3.1"
services:
php:
build:
nginx:
build:
context: .
dockerfile: Dockerfile
ports: