-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathsingle-tenant-odscontexts-clean.ps1
33 lines (27 loc) · 1.24 KB
/
single-tenant-odscontexts-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
# 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')]
[string] $engineFolder = 'pgsql'
)
$composeFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'SingleTenant-OdsContext', 'compose-single-tenant-odscontext-env.yml')
$composeOverrideFilePath = [IO.Path]::Combine($PSScriptRoot, 'Compose', $engineFolder, 'SingleTenant-OdsContext', 'compose-single-tenant-odscontext-env.override.yml')
$envFilePath = [IO.Path]::Combine($PSScriptRoot, '.env')
$params = @(
"-f", $composeFilePath,
"--env-file", $envFilePath,
"-p", "single-tenant-odscontexts",
"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)