-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD-DOCKER-IMAGE.sh
executable file
·28 lines (23 loc) · 1.04 KB
/
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
24
25
26
27
28
#!/bin/bash
################################################################################
# Set the Docker container name from a project name (first argument).
# If no argument is given, use the current user name as the project name.
PROJECT=$(whoami)
CONTAINER="${PROJECT}_tetris_1"
echo "$0: PROJECT=${PROJECT}"
echo "$0: CONTAINER=${CONTAINER}"
# Stop and remove the Docker container.
EXISTING_CONTAINER_ID=`docker ps -aq -f name=${CONTAINER}`
if [ ! -z "${EXISTING_CONTAINER_ID}" ]; then
# echo "Stop the container ${CONTAINER} with ID: ${EXISTING_CONTAINER_ID}."
# docker stop ${EXISTING_CONTAINER_ID}
# echo "Remove the container ${CONTAINER} with ID: ${EXISTING_CONTAINER_ID}."
# docker rm ${EXISTING_CONTAINER_ID}
echo "The container name ${CONTAINER} is already in use" 1>&2
echo ${EXISTING_CONTAINER_ID}
exit 1
fi
################################################################################
# Build the Docker image with the Nvidia GL library.
echo "starting build"
docker-compose -p ${PROJECT} -f ./docker-compose.yml build