-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-publish.ps1
29 lines (20 loc) · 970 Bytes
/
docker-publish.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
$ImageName = "lutron_qs_exporter"
$RawImageVersion = poetry version -s
$ImageVersion = $RawImageVersion -replace '[^a-zA-Z0-9_.-]', '_'
$NexusPushRepositoryURL = "monster-jj.jvj28.com:9092"
$Username = $env:NEXUS_USERNAME
$Password = $env:NEXUS_PASSWORD
$DockerName = "$($NexusPushRepositoryURL)/$($ImageName)"
# Tag the Docker image
Write-Output "Image tagged successfully."
# Log in to Docker
Write-Output $Password | docker login $NexusPushRepositoryURL --username $Username --password-stdin
# Push the Docker image
Write-Output "Tagging image with tag: $($ImageVersion)..."
docker tag $ImageName "$($DockerName):$($ImageVersion)"
docker tag $ImageName "$($DockerName):latest"
Write-Output "Pushing Docker image to Nexus repository..."
docker push "$($DockerName):$($ImageVersion)"
Write-Output "Pushing Docker image $($ImageName):latest to Nexus repository."
docker push "$($DockerName):latest"
Write-Output "Image pushed to Nexus repository successfully."