forked from Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-tenant-env-clean.ps1
42 lines (35 loc) · 1.55 KB
/
single-tenant-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
# 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"
$composeFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'SingleTenant', 'compose-single-tenant-env.yml')
$composeOverrideFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'SingleTenant', 'compose-single-tenant-env.override.yml')
}
else {
$engineFolder = "mssql"
$composeFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'compose-single-tenant-env.yml')
$composeOverrideFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'compose-single-tenant-env.override.yml')
}
$envFilePath = [IO.Path]::Combine($PSScriptRoot, '.env')
$params = @(
"-f", $composeFilePath,
"--env-file", $envFilePath,
"-p", "single-tenant-ods",
"down",
"-v",
"--remove-orphans"
)
# If the compose override exists, insert the -f parameter to get it merged
if (Test-Path $composeOverrideFilePath) {
$params = $params[0..1] + "-f" + $composeOverrideFilePath + $params[2..8]
}
& docker compose $params
# Remove downloaded images
docker rmi $(docker images --filter=reference="edfialliance/ods-*" -q)
docker rmi $(docker images --filter=reference="bitnami/pgbouncer:*" -q)