-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
44 lines (41 loc) 路 948 Bytes
/
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
version: '3.10' #version of docker-compose
services:
db:
image: postgres:14.1-alpine #pull postgres image from Dockerhub
container_name: sampletodo_db
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '127.0.0.1:3000:5432'
volumes:
- db:/var/lib/postgresql/data
networks:
mynet:
aliases:
- db
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 1s
retries: 3
web:
build: .
container_name: sampletodo_web
depends_on:
db:
condition: service_healthy # to make sure that database is ready to start
ports:
- '127.0.0.1:8000:8080'
environment:
POSTGRES_URL: postgresql://postgres:postgres@db:5432/postgres
volumes:
- './:/src'
networks:
mynet:
volumes:
db:
driver: local
networks:
mynet:
driver: bridge