From 4c2414fa0a2655721946e2d8f905a3a36954c661 Mon Sep 17 00:00:00 2001 From: Shaz hemani Date: Fri, 11 Sep 2020 17:09:53 +0500 Subject: [PATCH] issue #1 and #2 --- Makefile | 4 ++-- docker-compose.yml | 4 ++-- main.go | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4aaf8b8..6617c0d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ build: docker-compose build -run: build - docker-compose up +run: + COMPOSE_PROJECT_NAME=genitywebapp docker-compose up --build build-binary: GOOS=linux GOARCH=amd64 go build diff --git a/docker-compose.yml b/docker-compose.yml index e91e076..bab9efc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ -version: "3.8" +version: "3" services: db: image: postgres env_file: ./configs/db.env volumes: - - ./db_postgres:/var/lib/postgresql/data + - db_postgres:/var/lib/postgresql/data - ./scripts/db/ddl_01.sql:/docker-entrypoint-initdb.d/10_schema.sql - ./scripts/db/dml_01.sql:/docker-entrypoint-initdb.d/20_insert.sql expose: diff --git a/main.go b/main.go index 2ad1260..133d0f4 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,6 @@ func main() { } - func initDb() { config := dbConfig() var err error @@ -52,7 +51,7 @@ func initDb() { func dbConfig() map[string]string { conf := make(map[string]string) - conf[dbhost] = "POC-golang-postgres-docker_db_1" + conf[dbhost] = "genitywebapp_db_1" conf[dbport] = "5432" conf[dbuser] = "root_user" conf[dbpass] = "shahzad12"