-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
54 lines (43 loc) · 2.15 KB
/
docker-compose.yaml
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
version: '3.9'
services:
bot:
# Name of the Container (by default the 'services' name)
container_name: 'confusing-bot'
# Build 'backend' Container using the 'Dockerfile'
build: .
# Always restart the Container (in the case of a crash or a system reboot
restart: always
# Only starting this Container once the 'db' service finished starting up
depends_on:
- db
# Environment Variables
env_file:
- .env.local
db:
# Name of the Container (by default the 'services' name)
# Can be used to connect to this container from another container
container_name: 'confusing-db'
# Official Postgres image (Blueprint for Container) from DockerHub
image: 'postgres:latest'
# Always restart the Container (in the case of a crash or a system reboot
restart: always
# By default, a Postgres database is running on the 5432 port.
# If we want to access the database from outside the Container (e.g. from a local computer),
# we need to tell our computer which port of the Container to connect to,
# in order to access the database in the Container.
# The syntax to do so is [port we need to connect to externally]:[port we want to retrieve in the container]
# https://docs.docker.com/compose/networking/
ports:
- '5401:5432'
# The `volumes` tag allows us to share a folder with our Container.
# Its syntax is as follows: [folder path on our machine]:[folder path to retrieve in the container]
volumes:
# Here, we share the folder `.volumes/db-data` in our root repository, with the default PostgreSQL data path.
# It means that every time the repository is modifying the data inside
# of `/var/lib/postgresql/data/`, automatically the change will appear in `db-data`.
- './.volumes/db-data:/var/lib/postgresql/data'
# Environment Variables
environment:
POSTGRES_USER: 'postgres' # The PostgreSQL user (useful to connect to the database)
POSTGRES_PASSWORD: 'postgres' # The PostgreSQL password (useful to connect to the database)
POSTGRES_DB: 'confusing_bot' # The PostgreSQL default database (automatically created at first launch)