From 756944ab8679d0f89c8818f83c353eb6365513bb Mon Sep 17 00:00:00 2001 From: Thiago Pacheco Date: Sat, 20 Nov 2021 02:09:23 -0500 Subject: [PATCH] Included postgres into docker config --- .env | 3 +++ docker-compose.yaml | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..300fc78 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +DB_USER=postgres +DB_PASSWORD=root +DB_NAME=go-todo-db \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index f057264..207dd4a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,12 +9,33 @@ services: target: dev volumes: - .:/app + environment: + - POSTGRES_USER=${DB_USER} + - POSTGRES_PASSWORD=${DB_PASSWORD} + - POSTGRES_DB=${DB_NAME} ports: - "5000:5000" - "2345:2345" networks: - go-todo-network + go-todo-db: + container_name: go-todo-db + image: postgres + environment: + - POSTGRES_USER=${DB_USER} + - POSTGRES_PASSWORD=${DB_PASSWORD} + - POSTGRES_DB=${DB_NAME} + volumes: + - postgres-db:/var/lib/postgresql/data + ports: + - "5432:5432" + networks: + - go-todo-network + +volumes: + postgres-db: + networks: go-todo-network: name: go-todo-network \ No newline at end of file