-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
26 lines (23 loc) · 924 Bytes
/
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
version: "3.9"
# Docker automatically create a network and attach the services (containers) to it.
# DB
services:
postgres:
image: postgres:alpine #Image to wire up db
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=toor
- POSTGRES_DB=simple-bank
# BANK
api:
build:
context: . # Workdir relative to root in this case.
dockerfile: Dockerfile # Build BANK from Dockerfile of the root.
ports:
- "8080:8080" # Exposing port so we can call BANK from outside the container
environment: # Establish connection between BANK and DB
- DB_SOURCE=postgresql://root:toor@postgres/simple-bank?sslmode=disable
depends_on:
- postgres # Waits that postgres is ready and started before launching BANK api.
entrypoint: ["/app/wait-for.sh", "postgres:5432", "--", "/app/start.sh"] # Runs start.sh once postgres is ready.
command: [ "/app/main" ]