25 lines
521 B
Bash
25 lines
521 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
logout() {
|
||
|
docker logout "$GIT_ADDRESS"
|
||
|
}
|
||
|
|
||
|
trap logout EXIT
|
||
|
|
||
|
GIT_ADDRESS="git.0x45.cz"
|
||
|
IMAGE_NAME="$GIT_ADDRESS/em/mixtape"
|
||
|
DATE_TAG=$(date +%y%m%d)
|
||
|
|
||
|
docker build -t "${IMAGE_NAME}:${DATE_TAG}" -t "${IMAGE_NAME}:latest" .
|
||
|
|
||
|
read -rp "Enter your ${GIT_ADDRESS} username: " USERNAME
|
||
|
read -rsp "Enter your ${GIT_ADDRESS} password: " PASSWORD
|
||
|
echo
|
||
|
|
||
|
echo "$PASSWORD" | docker login -u "$USERNAME" "$GIT_ADDRESS" --password-stdin
|
||
|
|
||
|
docker push "${IMAGE_NAME}:${DATE_TAG}"
|
||
|
docker push "${IMAGE_NAME}:latest"
|