mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-01-16 13:08:36 +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
|
||||
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
|
||||
|
11
Makefile
11
Makefile
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
version: "3.1"
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
nginx:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
|
Loading…
x
Reference in New Issue
Block a user