From a80763de358da17f6ae8a558442101f4195951b5 Mon Sep 17 00:00:00 2001 From: viletyy Date: Sun, 4 Aug 2019 22:37:27 +0800 Subject: [PATCH] docker database use volumes --- .gitignore | 3 ++- README.md | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3794060..5a1fee7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ conf/app.ini .idea/* main -runtime/* \ No newline at end of file +runtime/* +data/docker-postgres/* \ No newline at end of file diff --git a/README.md b/README.md index 4181e34..4bb34e1 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ game_demo/ └── runtime # 应用运行时数据 ``` -### Run Server +### Run Server By Docker #### Before cp app.ini.local app.ini - +mkdir -p data/docker-postgres ```shell script -docker run --name postgres -p 5433:5432 -e POSTGRES_PASSWORD=123456 -d postgres +docker run --name postgres -p 5433:5432 -e POSTGRES_PASSWORD=123456 -v $GOPATH/src/game_demo/data/docker-postgres:/var/lib/postgresql/data -d postgres CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . docker build -t game_demo_scratch . docker run --link postgres:postgres -p 8000:8000 game_demo_scratch