-
Notifications
You must be signed in to change notification settings - Fork 260
/
build-docker-image.sh
23 lines (17 loc) · 806 Bytes
/
build-docker-image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# get version from package.json
appVersion=$(cat package.json | jq -r '.version')
# run the docker build command to create the Docker image
echo "Building Docker Vorlon.JS image version $appVersion"
docker build -t vorlonjs/dashboard:$appVersion .
# run the docker login command to authenticate to the Docker Hub
echo "Logging into the Docker Hub. Account is : $1"
docker login --username="$1" --password="$2"
# run the docker push command to push the new image to the hub
echo "Pushing the new Vorlon.JS image to the Docker Hub"
docker push vorlonjs/dashboard:$appVersion
# run the docker logout command to logout from the Docker Hub
echo "Logging out from the Docker Hub"
docker logout
echo "The image vorlonjs/dashboard:$appVersion has been pushed successfuly to the Docker Hub"
exit 0