mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-01-17 05:28:16 +01:00
#376 use multi-stage Docker build
This commit is contained in:
parent
d0ba13b686
commit
be66dcc037
22
Dockerfile
22
Dockerfile
@ -1,9 +1,17 @@
|
|||||||
FROM php:7.3.8-cli
|
FROM composer AS composer
|
||||||
WORKDIR /app
|
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
|
ADD . /app
|
||||||
RUN cd /app && make cs test html
|
RUN composer install \
|
||||||
CMD [ "php", "-S", "0.0.0.0:80", "-t", "_build/html" ]
|
&& ./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
|
||||||
|
11
Makefile
11
Makefile
@ -190,14 +190,3 @@ pseudoxml:
|
|||||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||||
@echo
|
@echo
|
||||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
@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
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
version: "3.1"
|
version: "3.1"
|
||||||
services:
|
services:
|
||||||
php:
|
nginx:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user