-
Notifications
You must be signed in to change notification settings - Fork 19
/
docker-compose.dev.yml
90 lines (84 loc) · 2.36 KB
/
docker-compose.dev.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
# `version` is now deprecated
# https://docs.docker.com/compose/compose-file/#version-top-level-element
services:
next-ts-app:
container_name: next-ts-app
build:
context: ./next-ts-app
dockerfile: dev.Dockerfile
environment:
ENV_VARIABLE: ${ENV_VARIABLE}
NEXT_PUBLIC_ENV_VARIABLE: ${NEXT_PUBLIC_ENV_VARIABLE}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_DATABASE: ${POSTGRES_DATABASE}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./next-ts-app/src:/app/src
- ./next-ts-app/public:/app/public
# It's not necessary to sync the `.next` directory
depends_on:
- postgres
restart: always
networks:
- my_network
next-js-app:
container_name: next-js-app
build:
context: ./next-js-app
dockerfile: dev.Dockerfile
environment:
ENV_VARIABLE: ${ENV_VARIABLE}
NEXT_PUBLIC_ENV_VARIABLE: ${NEXT_PUBLIC_ENV_VARIABLE}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_DATABASE: ${POSTGRES_DATABASE}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./next-js-app/src:/app/src
- ./next-js-app/public:/app/public
# It's not necessary to sync the `.next` directory
depends_on:
- postgres
restart: always
networks:
- my_network
nginx:
container_name: nginx
build:
context: ./nginx
dockerfile: Dockerfile
volumes:
- ./nginx/sites-enabled:/etc/nginx/sites-enabled
- ./nginx/logs:/var/log/nginx
ports:
- 80:80
- 443:443
- 3000:3000
depends_on:
- next-ts-app
- next-js-app
restart: always
networks:
- my_network
postgres:
container_name: postgres
build:
context: ./postgres
dockerfile: dev.Dockerfile
environment:
# The only variable required is `POSTGRES_PASSWORD`, the rest are optional
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DATABASE}
restart: always
networks:
- my_network
# Add more containers below
# Define a network, which allows containers to communicate
# with each other, by using their container name as a hostname
networks:
my_network:
external: true