forked from Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsandbox-env-clean.ps1
60 lines (50 loc) · 1.51 KB
/
sandbox-env-clean.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
param(
[ValidateSet('PostgreSQL', 'SQLServer')]
[string] $Engine = 'PostgreSQL'
)
if ($Engine -eq 'PostgreSQL') {
$engineFolder = "pgsql"
}
else {
$engineFolder = "mssql"
}
$composeFolder = (Resolve-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath Compose)).Path
$composeFile = Join-Path -Path $engineFolder -ChildPath compose-sandbox-env-build.yml
$envFile = (Join-Path -Path (Resolve-Path -Path $PSScriptRoot).Path -ChildPath .env)
docker-compose -f (Join-Path -Path $composeFolder -ChildPath $composeFile) --env-file $envFile down -v --remove-orphans
@(
"ed-fi-ods-docker_api",
"ed-fi-ods-docker_nginx",
"ed-fi-ods-docker_swagger",
"ed-fi-ods-docker_db-ods",
"ed-fi-ods-docker_db-admin",
"ed-fi-ods-docker_pb-admin",
"ed-fi-ods-docker_pb-admin",
"pgsql_swagger",
"pgsql_nginx",
"pgsql_admin",
"pgsql_db-ods",
"pgsql_db-admin",
"pgsql_pb-ods",
"pgsql-pb-admin",
"pgsql_pg-ods",
"pgsql_pg-admin",
"mssql_swagger",
"mssql_nginx",
"mssql_admin",
"mssql_db-ods",
"mssql_db-admin",
"mssql_pb-ods",
"mssql-pb-admin",
"mssql_pg-ods",
"mssql_pg-admin"
) | ForEach-Object {
$exists = (&docker images -q $_)
if ($exists) {
docker rmi $_ -f
}
}