Last active
April 15, 2023 23:51
-
-
Save carlos-a-g-h/d18c74b7d30bf40900a4d9e9370e942b to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Build and upload an image to Dockerhub | |
DH_USER="$1" | |
DH_PASS="$2" | |
DH_REPO="$3" | |
THE_DIR="$4" | |
RIGHT_NOW="$(date +%Y-%m-%d-%H-%M)" | |
TAG_LATEST="$DH_USER/$DH_REPO:latest" | |
TAG_VERSION="$DH_USER/$DH_REPO:$RIGHT_NOW" | |
docker build --tag myapp:local "$THE_DIR" | |
docker login --username "$DH_USER" --password "$DH_PASS" | |
docker tag myapp:local "$TAG_VERSION" | |
docker push "$TAG_VERSION" | |
docker tag "$TAG_VERSION" "$TAG_LATEST" | |
docker push "$TAG_LATEST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment