-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
103 lines (99 loc) · 2.53 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
version: '3'
services:
############################
# at, static
nginx:
image: nginx
ports:
- ${IP}:80:80
environment:
DOMAIN: ${DOMAIN}
SUBNET: ${SUBNET}
command:
- /bin/sh
- -c
- |
envsubst '$$DOMAIN $$SUBNET' < /etc/nginx/conf.d/api.template > /etc/nginx/conf.d/api.conf
envsubst '$$DOMAIN $$SUBNET' < /etc/nginx/conf.d/at.template > /etc/nginx/conf.d/at.conf
envsubst '$$DOMAIN $$SUBNET' < /etc/nginx/conf.d/github.template > /etc/nginx/conf.d/github.conf
envsubst '$$DOMAIN $$SUBNET' < /etc/nginx/conf.d/static.template > /etc/nginx/conf.d/static.conf
envsubst '$$DOMAIN $$SUBNET' < /etc/nginx/conf.d/frp.template > /etc/nginx/conf.d/frp.conf
nginx -g 'daemon off;'
networks:
frontend:
ipv4_address: ${SUBNET}.2
volumes:
- ./nginx/config:/etc/nginx/conf.d
- ./at/dist:/var/www/html
- ./static:/var/www/static
- ./api/laravel:/var/www/api
############################
# github
gitlab_hook:
image: node
working_dir: /root/github
command:
- /bin/sh
- -c
- |
npm i
node index.js
expose:
- 4000
networks:
frontend:
ipv4_address: ${SUBNET}.3
volumes:
- ./:/root
############################
# api
mysql:
image: mysql
command: mysqld --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: blog
MYSQL_USER: blog
MYSQL_PASSWORD: P@ssw0rd
MYSQL_ROOT_PASSWORD: P@ssw0rd
networks:
frontend:
ipv4_address: ${SUBNET}.4
volumes:
- ./api/mysql/data:/var/lib/mysql
- ./api/mysql/config:/etc/mysql
php:
image: php:7.2-fpm
working_dir: /var/www/api
command:
- /bin/sh
- -c
- |
./composer install
cp .env.example .env
php artisan key:generate
chown -R www-data storage/
chgrp -R www-data storage/
php-fpm
environment:
DB_CONNECTION: mysql
DB_HOST: ${SUBNET}.4
DB_DATABASE: blog
DB_USERNAME: blog
DB_PASSWORD: P@ssw0rd
HOST: http://api.${DOMAIN}
volumes:
- ./api/php/config:/usr/local/etc/php
- ./api/php/extensions:/usr/local/lib/php/extensions/no-debug-non-zts-20170718
- ./api/laravel:/var/www/api
networks:
frontend:
ipv4_address: ${SUBNET}.5
depends_on:
- mysql
networks:
frontend:
driver: bridge
ipam:
driver: default
config:
- subnet: ${SUBNET}.0/24