-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
70 lines (62 loc) · 2.46 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
59
60
61
62
63
64
65
66
67
68
69
70
version: "3.5"
services:
postgresql:
# Set a name for the container so that it can be accessed by name on the same network
container_name: postgresql
# Official Postgres image from DockerHub (we use the last version)
image: postgres:latest
# ------------------------------------------------------------------------------
# Set environment variables for the container
# However, for security reasons, we will use .env instead
# environment:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# The PostgreSQL default database (automatically created at first launch)
# POSTGRES_DB: petapp-db
# PGDATA: /data/postgres # (the data directory)
# ------------------------------------------------------------------------------
env_file:
- .env
# # By default, a Postgres database is running on the 5432 port.
# If we want to access the database from our computer (outside the container),
# we must share the port with our computer's port.
# The syntax is [port we want on our machine]:[port we want to retrieve in the container]
# Note: You are free to change your computer's port,
# but take into consideration that it will change the way
# you are connecting to your database.
ports:
- 5432:5432
networks:
- postgres-networks
restart: unless-stopped
# we share the folder `postgresql-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 `postgresql-data`.
# You don't need to create the `postgresql-data` folder. Docker Compose will do it for you.
# volumes:
# - ./postgresql-data:/var/lib/postgresql/data/
# redis is a key-value store, so we can use it to store our session tokens.
redis:
container_name: redis-server
image: redis:latest
ports:
- 6379:6379
networks:
- postgres-networks
restart: unless-stopped
# postgresql-admin is a utility tool to manage the PostgreSQL database.
postgresadmin:
container_name: postgresadmin
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: pgadmin4@petapp.com
PGADMIN_DEFAULT_PASSWORD: pgadmin4
PGADMIN_CONFIG_SERVER_MODE: "False"
ports:
- "5050:80"
networks:
- postgres-networks
restart: unless-stopped
networks:
postgres-networks:
driver: bridge