forked from friday23/docker-dev-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
62 lines (58 loc) · 1.71 KB
/
docker-compose.yml
File metadata and controls
62 lines (58 loc) · 1.71 KB
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
version: '3.8'
services:
# These are the configurations for our React app
# When Docker Compose starts this container it will automatically
# use the Dockerfile in the directory to configure it
my-app-frontend:
build: ./frontend
volumes:
- my-app:/home/app
container_name: my-app-frontend
networks:
- my-app-network
ports:
- 3000:3000
# Needed to keep the container from exiting
stdin_open: true
# These are the configurations for our Node app
# When Docker Compose starts this container it will automatically
# use the Dockerfile in the directory to configure it.
# Note the `my-app-backend` name is important, in our React app, when we
# refer to `"proxy": "http://my-app-backend:8080"` in package.json, that
# value is mapped on the network to the address and port of this container.
my-app-backend:
depends_on:
- my-app-db
build: ./backend
volumes:
- my-app:/home/app
container_name: my-app-backend
networks:
- my-app-network
ports:
- 8080:8080
# This is the configuration for our PostgreSQL database container
# Note the `my-app-db` name is important; in our Node app when we refer
# to `host: 'my-app-db'` in server.js, that value is mapped on the
# network to the address of this container.
my-app-db:
image: postgres:14-alpine
restart: always
environment:
POSTGRES_USER: example
POSTGRES_PASSWORD: example
POSTGRES_DB: mydb
volumes:
- postgresdata:/var/lib/postgresql/data
container_name: my-app-db
networks:
- my-app-network
ports:
- 5432:5432
volumes:
my-app:
external: true
postgresdata:
networks:
my-app-network:
external: true