-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild-docker.sh
executable file
·45 lines (37 loc) · 1.2 KB
/
build-docker.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# echo "YOUR_PERSONAL_ACCESS_TOKEN" | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin
# Enable echo of commands
set -e
echo "This script will build and push a Docker image."
echo
echo "About to build the Docker image: ghcr.io/gudarzi/savehere"
echo
read -p "Do you want to proceed with the build? (y/N): " confirm
if [[ $confirm =~ ^[Yy]$ ]]; then
echo "Building Docker image..."
if docker build -t ghcr.io/gudarzi/savehere -f ./SaveHere/SaveHere/Dockerfile .; then
echo "Build successful."
echo
echo "About to push the Docker image to: ghcr.io/gudarzi/savehere"
echo
read -p "Do you want to proceed with the push? (y/N): " confirm_push
if [[ $confirm_push =~ ^[Yy]$ ]]; then
echo "Pushing Docker image..."
if docker push ghcr.io/gudarzi/savehere; then
echo "Push successful."
else
echo "Push failed."
exit 1
fi
else
echo "Push cancelled by user."
fi
else
echo "Build failed. Exiting script."
exit 1
fi
else
echo "Build cancelled by user."
fi
echo
echo "Script finished."