-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·31 lines (23 loc) · 770 Bytes
/
Copy pathsetup.sh
File metadata and controls
executable file
·31 lines (23 loc) · 770 Bytes
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
#!/bin/bash
# Set the root directory as the directory where the script is located
root_directory="$(cd "$(dirname "$0")" && pwd)"
# Change to the root directory
cd "$root_directory"
# Prompt for and store the account name
read -p "Enter your account name: " account_name
# Prompt for Docker registry credentials
docker login -u $account_name
# Function to build and push Docker images
build_and_push_docker_images() {
for folder in */; do
if [ -f "$folder/Dockerfile" ]; then
sub_folder_name="${folder%/}"
# Build Docker image
docker build -t "$account_name/$sub_folder_name" "$folder"
# Push Docker image
docker push "$account_name/$sub_folder_name"
fi
done
}
# Check inside each sub-folder
build_and_push_docker_images