-app:
- image: php:7.0-fpm-alpine
- volumes:
- #- ./../../../..:/opt/nb
- - ./../../../../..:/opt
- - ./../../../../www/dbq:/var/www/html
- #- ./:/var/www/html
- #- ./../../../../lib/php/db:/var/www/html
- command: "echo . /opt/nb/etc/profile > /etc/profile.d/nb.sh"
-php:
- build: ../../php/
- volumes_from:
- - app
- expose:
- - 9000
+version: '2'
+services:
+ app:
+ image: php:7.0-fpm-alpine
+ environment:
+ NB_ROOT: /opt/nb
+ volumes:
+ #- ./../../../..:/opt/nb
+ - ./../../../../..:/opt
+ - ./../../../../www/dbq:/var/www/html
+ #- ./:/var/www/html
+ #- ./../../../../lib/php/db:/var/www/html
+ command: "echo . $NB_ROOT/etc/profile > /etc/profile.d/nb.sh"
+ php:
+ build: ../../php/
+ volumes_from:
+ - app
+ expose:
+ - 9000
-nginx:
- build: ../../nginx/
- #image: nginx:latest
- volumes_from:
- - php
- ports:
- - "8080:80"
- links:
- - php
+ nginx:
+ build:
+ context: ../../nginx/
+ args:
+ - WWW_ROOT=$NB_ROOT/www/dbq
+ #image: nginx:latest
+ volumes_from:
+ - php
+ ports:
+ - "8080:80"
+ links:
+ - php
FROM nginx:latest
+ARG WWW_ROOT
+ENV WWW_ROOT=${WWW_ROOT:-/var/www/html}
COPY ./default.conf /etc/nginx/conf.d/default.conf
-RUN mkdir -p /var/www/html && echo '<html><head><title>Welcom to Nginx</title></head><body><h1>Welcom to Nginx</h1></body></html>' > /var/www/html/index.html
+RUN sed -ie 's,^\([\t ]*root \).*$,\1'$WWW_ROOT';,' /etc/nginx/conf.d/default.conf
+RUN mkdir -p $WWW_ROOT && echo '<html><head><title>Welcom to Nginx</title></head><body><h1>Welcom to Nginx</h1></body></html>' > $WWW_ROOT/index.html
CMD nginx -g 'daemon off;'