-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
58 lines (55 loc) · 1.63 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
version: '3.8'
services:
posts:
build: .
env_file:
- .env
depends_on:
# Our app does not work without our database
# so this ensures our database is loaded first
- postgres
ports:
- "3001:3001"
volumes:
- ./:/usr/src/app/
# node_modules workaround for volumes
command: npm run start:dev
networks:
- mynetwork
# This is the configuration for our PostgreSQL database container
# Note the `postgres` name is important, in out Node app when we refer
# to `host: "postgres"` that value is mapped on the network to the
# address of this container.
postgres:
image: postgres:14.1-alpine
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
# Standard port for PostgreSQL databases
- "5432:5432"
volumes:
# When the PostgresSQL container is started it will run any scripts
# provided in the `docker-entrypoint-initdb.d` directory, this connects
# our seed file to that directory so that it gets run
- ./db/database-seed.sql:/docker-entrypoint-initdb.d/database-seed.sql
- ./db/data:/var/lib/postgresql/data
networks:
- mynetwork
# PostgreSQL pgAdmin panel accessible at http://localhost:16543/
pgadmin-compose:
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
ports:
- "16543:80"
depends_on:
- postgres
networks:
- mynetwork
networks:
mynetwork:
name: mynetwork