This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathdocker-compose.yml
54 lines (54 loc) · 2.51 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
# docker-compose.yml
# Usage:
# export PAYID_DOCKER_IMAGE_VERSION=$(node -p "require('./package.json').version")
# docker-compose up -d --build
version: '3'
services:
payid_server:
# Defines the container name when using "docker-compose up". Warning: does not work with "docker-compose run" (Docker issue)
container_name: 'payid-server'
# Defines the image name and tag.
image: payid:${PAYID_DOCKER_IMAGE_VERSION}
# As we define the build context, the image is not pulled from Dockerhub. It is built locally based on our Dockerfile.
build:
context: .
# Port mapping, external_port:internal_port
ports:
- '8080:8080'
- '8081:8081'
# The payid container can't run alone. A Postgres container will always be created thanks to "depends_on"
depends_on:
- 'db'
environment:
# Used in wait-for-postgres.sh and by payid. The value must be the same as the POSTGRES_PASSWORD value in the db service.
- DB_PASSWORD=password
# Uncomment DB_NAME if you change POSTGRES_DB in the "db" service below
#- DB_NAME=database_development
# DB_HOSTNAME is used by wait-for-postgres.sh and payid to point at the right host (default is 127.0.0.1 which would fail)
- DB_HOSTNAME=db
# uncomment DB_USERNAME if POSTGRES_USER in the db service is uncommented and different than "postgres". DB_USERNAME and POSTGRES_USER must have the same values
#- DB_USERNAME=postgres
# "command" overrides CMD in the Dockerfile to use wait-for-postgres.sh and make sure Postgres is ready to execute SQL scripts
# If we don't do this check, we will end up seeing error messages like:
# psql: error: could not connect to server: could not connect to server: Connection refused
command:
[
'/opt/payid/scripts/wait-for-postgres.sh',
'db',
'node',
'/opt/payid/build/src/index.js',
]
db:
container_name: payid-database
# Image pulled from Dockerhub
image: postgres:12-alpine
# external_port:internal_port
ports:
- '${DB_PORT:-5432}:5432'
environment:
# POSTGRES_PASSWORD is mandatory. If POSTGRES_PASSWORD != password, update DB_PASSWORD in the payid service
- POSTGRES_PASSWORD=password
# If POSTGRES_DB != database_development, change DB_NAME in the payid service above
- POSTGRES_DB=database_development
# Uncomment if you want to change the Postgres user (in that case, change DB_USERNAME in the payid service). Default value: postgres
#- POSTGRES_USER=postgres