-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.ps1
More file actions
27 lines (22 loc) · 707 Bytes
/
build.ps1
File metadata and controls
27 lines (22 loc) · 707 Bytes
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
#!/bin/sh
# ------------------------
# 构建镜像
# bin/build.sh
# ------------------------
function del_image([string]$image_name) {
$image_id = (docker images -q --filter reference=${image_name})
if(![string]::IsNullOrEmpty(${image_id})) {
Write-Host "delete [${image_name}] ..."
docker image rm -f ${image_id}
Write-Host "done ."
}
}
function build_image([string]$image_name, [string]$dockerfile) {
del_image ${image_name}
docker build -t ${image_name} -f ${dockerfile} .
}
$image_name = (Split-Path $pwd -leaf)
build_image ${image_name} "Dockerfile"
docker-compose build
docker image ls | Where-Object {$_ -like "*${image_name}*"}
Write-Host "finish ."