Skip to content

Instantly share code, notes, and snippets.

@phillipsj
Created October 17, 2020 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillipsj/23bc62fc3e5eb7d0aa24d88829846b5f to your computer and use it in GitHub Desktop.
Save phillipsj/23bc62fc3e5eb7d0aa24d88829846b5f to your computer and use it in GitHub Desktop.
Building our backup containers
if ((Get-ChildItem -Recurse -Path **\\Dockerfile).Count -gt 0) {
$dockerFiles = Get-ChildItem -Recurse -Path **\\Dockerfile | Select-Object -ExpandProperty DirectoryName -Unique
$dockerFiles | ForEach-Object {
Push-Location $_;
$directory = Get-Item Dockerfile | Select-Object -ExpandProperty Directory
docker build -t $directory.Name .
Pop-Location;
}
}
else {
Write-Host "No Dockerfiles found!"
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment