forked from json-api-dotnet/JsonApiDotNetCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-docker-postgres.ps1
18 lines (13 loc) · 967 Bytes
/
run-docker-postgres.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Requires -Version 7.0
# This script starts a PostgreSQL database in a docker container, which is required for running tests locally.
# When the -UI switch is passed, pgAdmin (a web-based PostgreSQL management tool) is started in a second container, which lets you query the database.
# To connect to pgAdmin, open http://localhost:5050 and login with user "[email protected]", password "postgres". Use hostname "db" when registering the server.
param(
[switch] $UI=$False
)
docker container stop jsonapi-postgresql-db
docker container stop jsonapi-postgresql-management
docker run --pull always --rm --detach --name jsonapi-postgresql-db -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:latest
if ($UI) {
docker run --pull always --rm --detach --name jsonapi-postgresql-management --link jsonapi-postgresql-db:db -e [email protected] -e PGADMIN_DEFAULT_PASSWORD=postgres -p 5050:80 dpage/pgadmin4:latest
}