Created
March 11, 2018 23:45
-
-
Save hoanga/8c36fe98c9d322bbbd29cf722bb139fa to your computer and use it in GitHub Desktop.
Powershell helper functions for kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM kterada0509/docker-revel:latest | |
EXPOSE 9000 | |
ADD . /go/src/myapp-revel | |
WORKDIR $GOPATH | |
CMD revel run myapp-revel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A utility function for setting relevant kubernetes variables in | |
# a powershell process | |
function set-dockerenv | |
{ | |
$res = minikube docker-env | select-string "^export (DOCKER_\S*?)\s*=\s*(.*)$" | |
$res | foreach-object -process { | |
if ($_ -match '^export (DOCKER_\S*?)\s*=\s*(.*)$') | |
{ set-item -force -path "env:$($matches[1])" -value $matches[2].replace('"', ''); } | |
else | |
{ write-error "Error setting $matches[1] to $matches[2]" } | |
} | |
} | |
# A utility function for clearing relevant kubernetes env variables from | |
# powershell | |
function unset-dockerenv | |
{ | |
$res = minikube docker-env -u | |
$res | foreach-object -process { | |
if ($_ -match '^unset (DOCKER_\S*?)$') | |
{ set-item -force -path "env:$($matches[1])" -value ''; } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment