generated from BRAVO68WEB/typescript-express-hasura-pgsql-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
47 lines (46 loc) · 1.74 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
version: '3.8'
services:
# 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
app:
build: .
depends_on:
# Our app does not work without our database
# so this ensures our database is loaded first
- postgres
environment:
- DATABASE_URL=postgresql://postgres:password@my-postgres-container:5432/urbanize
ports:
- '8080:8080'
volumes:
# Maps our current project directory `.` to
# our working directory in the container
- ./:/usr/src/app/
# node_modules workaround for volumes
# https://stackoverflow.com/a/32785014
- /usr/src/app/node_modules
# This is the configuration for our PostgreSQL database container
# Note the `postgres` name is important, in our Node app when we refer
# to `host: "postgres"` that value is mapped on the network to the
# address of this container.
postgres:
container_name: my-postgres-container # Set the container name
image: postgres:14.1-alpine
restart: always
environment:
# You can set the value of environment variables
# in your docker-compose.yml file
# Our Node app will use these to connect
# to the database
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=urbanize
ports:
# Standard port for PostgreSQL databases
- '5432:5432'
volumes:
# When the PostgreSQL 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
- ./database-seed.sql:/docker-entrypoint-initdb.d/database-seed.sql