echo"Error: contained_repo can't be blank or checking for its files in the container won't work."
exit1
fi
# ls $contained_repo
echo"* checking for $contained_good_repo_flag_path on the destination..."
ls $contained_good_repo_flag_path > /dev/null
if[$? -ne 0];then
echo"NOT FOUND"
exit1
else
echo"FOUND (already extracted)"
fi
# ls $contained_repo > /dev/null
ls $contained_good_repo_flag_path > /dev/null
if[$? -ne 0];then
echo"Error: extracting linux-minetest-kit.zip in the container didn't work. Extract linux-minetest-kit.zip to $contained_repos such that $contained_good_repo_flag_path exists in the container and try again."
exit1
else
echo"* detected $contained_good_repo_flag_path (So the source directory is assumed to be ok)"
fi
if[ ! -d "$contained_repo"];then
echo"Error: \"$contained_repo\" doesn't exist."
exit1
fi
echo"* building libraries using $repo_build_libs_cmd..."
cd"$contained_repo"
if[$? -ne 0];thenexit 1;fi
# $repo_build_libs_cmd
# if [ $? -ne 0 ]; then exit 1; fi
echo
echo"* building program using $build_finetest_server_cmd..."
echo"* The container will be built using the existing docker image $image_name"
echo"* The container will be built using the existing docker image $library_image"
fi
cat <<END
@ -119,7 +112,7 @@ How to use the image:
sudo docker image ls
# ^ See what images are installed (one image can be used for many containers).
sudo docker rmi $image_name
sudo docker rmi $library_image
# ^ Remove a docker image (This is necessary after updating the unversioned Docker image to avoid cached RUN commands from doing nothing when the script after RUN changes).
sudo docker image prune
@ -138,9 +131,9 @@ How to use the image:
# ^ "run" is merely a combination of "create" and "start"
sudo docker -w $contained_repoexec$container_name ls -l $contained_repos
# ^ Execute a command in a running container (exec shows an error if the container isn't running).
# This will not work if the run/start command that started the container isn't a command that keeps it open (runs indefinitely)!
# That is because the Dockerfile ENTRYPOINT (or if customized on a per-container basis, the "docker run" command) specifies the entry point (permanently) for the container.
# If you need a container that has changes after $run_all_build_commands_script runs or runs a different command, you must use the "commit" subcommand to create a new image.
# w: working directory
@ -148,7 +141,7 @@ How to use the image:
# ^ Stop a container by name (See <https://www.tecmint.com/name-docker-containers/>)
# You must use the container name (as determined using the "ps" subcommand), not the image name.
sudo docker container run -it $image_name /bin/bash
sudo docker container run -it $library_image /bin/bash
# ^ Run an interactive terminal (Type 'exit' to exit)
# (based on <https://phoenixnap.com/kb/docker-run-command-with-examples>)
@ -189,15 +182,37 @@ if [ "@$container_Id" = "@" ]; then
fi
END
echo"container_Id=$container_Id"
# echo "building within the container..."
# sudo docker start $container_name
# ^ NOTE: start is useless here since it won't stay open unless the
# command is set to "bash" or something, which isn't desirable.
# Therefore, use run instead of exec below.
# ^ output is $container_name
if["@$container_Id" !="@"];then
echo"* The container already appears to be set up."
exit0
fi
echo"There is no container_Id for container_name=$container_name, so checking for image:"
sudo docker image inspect $docker_finetest_server_image_name --format "* docker is looking for the image..."
if[$? -ne 0];then
echo"NOT FOUND, so:"
echo"* building $docker_finetest_server_image_name ($docker_finetest_server_image_dir inherits $library_image, so using built libraries from that should work)..."