-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_build.sh
More file actions
executable file
·41 lines (32 loc) · 1.13 KB
/
docker_build.sh
File metadata and controls
executable file
·41 lines (32 loc) · 1.13 KB
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
#!/bin/bash
GREEN='\e[32m'
YELLOW='\e[33m'
CYAN='\e[36m'
BOLD='\e[1m'
RESET='\e[0m'
# Exit immediately if a command exits with a non-zero status
set -e
#Get version number
echo -n "Enter version number: "
read version
# Set Docker image name and tag
IMAGE_NAME="stm32f103-arm-baremetal"
IMAGE_TAG="1.0.$version"
# Print build start message
echo "${YELLOW}=================================================${RESET}"
echo " Building Docker development environment..."
echo " Image Name: ${IMAGE_NAME}:${IMAGE_TAG}"
echo "${YELLOW}=================================================${RESET}"
# Build the Docker image with user-specific build arguments
docker build \
--build-arg HOST_UID=$(id -u) \
--build-arg HOST_GID=$(id -g) \
--build-arg USER_NAME=$(whoami) \
-t "${IMAGE_NAME}:${IMAGE_TAG}" .
echo ""
# Print build completion message and usage instructions
echo "================================================="
echo "${BOLD}${GREEN} Build complete!${RESET}"
echo " You can now run the container using:"
echo " docker run -it --rm -v \$(pwd):/project ${IMAGE_NAME}:${IMAGE_TAG}"
echo "================================================="