version: '3'
services:
frontend-nginx:
build:
context: ./frontend/docker
dockerfile: nginx.docker
volumes:
- ./frontend:/frontend
depends_on:
- manager-php-fpm
frontend-nodejs:
image: node:10.11-jessie
command: npm run dev
volumes:
- ./frontend:/frontend
working_dir: /frontend
ports:
- "3000:3000"
environment:
HOST: 0.0.0.0
tty: true
server {
listen 80
location / {
proxy_pass http://frontend-nodejs:3000;
}
}
frontend-init: frontend-install
frontend-install:
docker-compose exec frontend-nodejs npm install
Я так понимаю, что нужно использовать два конфига: docker-dev/docker-prod и nginx/dev nginx/prod
Но я не могу понять как и тот и другой настроить правильно для двух режимов? Можете помочь?
# Development configuration
version: "3.1"
services:
# Php application
app:
container_name: cc.app
build:
context: .
dockerfile: ./docker/php/Dockerfile-dev
restart: on-failure
volumes:
- .:/www
- ./docker/php/log:/var/log
- ./docker/php/usr/local/etc/php/conf.d:/usr/local/etc/php/conf.d
depends_on:
- db
links:
- db
expose:
- 9000
environment:
PHP_INI_SCAN_DIR: ":/usr/local/etc/php/conf.d"
# Database
db:
image: percona:latest
container_name: cc.db
restart: on-failure
ports:
- 127.0.0.160:3306:3306
expose:
- 3306
environment:
- MYSQL_ROOT_PASSWORD=rk3kw1UDdqOEF4L1pmNkcyQ2oL
- MYSQL_DATABASE=cc
- MYSQL_ROOT_HOST=%
# Nginx api server
nginx-api:
container_name: cc.nginx-api
image: nginx:latest
restart: on-failure
volumes:
- ./docker/nginx/dev/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/dev/sites-enabled/vhost-api.conf:/etc/nginx/sites-enabled/vhost-api.conf
ports:
- 127.0.0.160:8090:80
depends_on:
- app
expose:
- 80
command: ["nginx", "-g", "daemon off;"]
# Nginx admin server
nginx-admin:
container_name: cc.nginx-admin
image: nginx:latest
restart: on-failure
volumes:
- ./docker/nginx/dev/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/dev/sites-enabled/vhost-admin.conf:/etc/nginx/sites-enabled/vhost-admin.conf
ports:
- 127.0.0.160:8091:80
depends_on:
- app
expose:
- 80
command: ["nginx", "-g", "daemon off;"]
# Nginx secure server
nginx-secure:
container_name: cc.nginx-secure
image: nginx:latest
restart: on-failure
volumes:
- ./docker/nginx/dev/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/dev/sites-enabled/vhost-secure.conf:/etc/nginx/sites-enabled/vhost-secure.conf
ports:
- 127.0.0.160:8092:80
depends_on:
- app
expose:
- 80
command: ["nginx", "-g", "daemon off;"]
# Production configuration
version: "3.1"
services:
# Php application
app:
container_name: ruintouch.app
restart: always
build:
context: .
dockerfile: ./docker/php/Dockerfile-prod
expose:
- 9000
# Nginx api server
nginx-api:
container_name: ruintouch.nginx-api
image: nginx:latest
restart: always
volumes:
- ./docker/nginx/prod/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/prod/sites-enabled/vhost-api.conf:/etc/nginx/sites-enabled/vhost-api.conf
ports:
- 8095:80
expose:
- 80
command: ["nginx", "-g", "daemon off;"]
# Nginx admin server
nginx-admin:
container_name: ruintouch.nginx-admin
image: nginx:latest
restart: always
volumes:
- ./docker/nginx/prod/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/prod/sites-enabled/vhost-admin.conf:/etc/nginx/sites-enabled/vhost-admin.conf
ports:
- 8096:80
expose:
- 80
command: ["nginx", "-g", "daemon off;"]
#Nuxt publication
nuxt-public:
container_name: ruintouch.nuxt_public
restart: always
build:
context: ./nuxt_public
dockerfile: Dockerfile-prod
ports:
- "3001:3000"
expose:
- "3000"