docker database use volumes
This commit is contained in:
parent
28c9a98dd0
commit
a80763de35
|
@ -17,3 +17,4 @@ conf/app.ini
|
|||
.idea/*
|
||||
main
|
||||
runtime/*
|
||||
data/docker-postgres/*
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue