-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
49 lines (45 loc) · 1.58 KB
/
docker-compose.yml
File metadata and controls
49 lines (45 loc) · 1.58 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
version: "3.9" # specify docker-compose version
services: # defines a group of containers
client: # name of the react container
build: # specify build configuration
context: ./client # path of the Dockerfile
ports: # expose ports, host:container
- 3000:5173
volumes: # specifies volumes to mount, host:container
- ./client/src:/app/client/src
- ./client/public:/app/client/public
- dist:/app/client/dist
command: npm run dev # start the vite dev server
server: # name of the node container
build:
context: ./server
ports:
- 1337:1337
restart: always # restart container if it crashes
volumes:
- ./server/src:/app/server/src
- dist:/app/client/dist
environment: # environment variables for the container
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=devdb
- DB_USER=devuser
- DB_PASSWORD=changeme
- HOST=0.0.0.0
- PORT=1337
depends_on: # wait for the postgres container to be "ready" before starting the node container
- db
command: npm run dev # override default command in Dockerfile
db: # name of the postgres container
image: postgres:13 # specify image to build container from, alpine is a lightweight linux distro
volumes:
- db-data:/var/lib/postgresql/data
ports:
- 5432:5432
environment:
- POSTGRES_DB=devdb
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=changeme
volumes: # specify volumes to be created
dist: # name of the client volume, nothing else needs to be specified
db-data: # name of the database volume