forked from lasp/adamant_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add singular script
adamant_env.sh
to handle container creation
Convert Docker run script to Docker Compose (`docker compose up -d`) Make `adamant_env.sh` executable Add all usage args to `adamant_env.sh` output when run with no args Reword `adamant_env.sh` output to be more approachable to users Change `stop` arg to stop the container rather than remove Remove scripts replaced by `adamant_env.sh` Retain and use `docker_config.sh` for user configuration Add Docker Compose network mode for changes in lasp#24 Apply `compose.yaml` fixes for Windows Rename compose.yaml->compose.yml Update compose.yml to use docker_config.sh vars Improve `adamant_env.sh` input handling Convert remaining `docker` commands to `docker-compose` Fix script `build` arg to function with `docker-compose`
- Loading branch information
Showing
11 changed files
with
94 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
|
||
set +e | ||
|
||
if ! command -v docker &> /dev/null | ||
then | ||
if command -v podman &> /dev/null | ||
then | ||
function docker() { | ||
podman $@ | ||
} | ||
else | ||
echo "Neither docker nor podman found!!!" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
set -e | ||
|
||
. ${this_dir}/docker_config.sh | ||
|
||
DOCKER_COMPOSE_COMMAND="docker compose" | ||
DOCKER_COMPOSE_CONFIG="${this_dir}/compose.yml" | ||
export DOCKER_COMPOSE_COMMAND | ||
${DOCKER_COMPOSE_COMMAND} version &> /dev/null | ||
if [ "$?" -ne 0 ]; then | ||
export DOCKER_COMPOSE_COMMAND="docker-compose" | ||
fi | ||
|
||
usage() { | ||
echo "Usage: $1 [start, stop, login, push, build, remove]" >&2 | ||
echo "* start: create and start the adamant_example container" >&2 | ||
echo "* stop: stop the running adamant_example container" >&2 | ||
echo "* login: login to the adamant_example container" >&2 | ||
echo "* push: push the image to the Docker registry" >&2 | ||
echo "* build: build the image from the Dockerfile" >&2 | ||
echo "* remove: remove network and volumes for adamant_example" >&2 | ||
exit 1 | ||
} | ||
|
||
case $1 in | ||
start ) | ||
execute "${DOCKER_COMPOSE_COMMAND} -f compose.yml up -d" | ||
echo "" | ||
echo "Run \"./adamant_env.sh login\" to log in." | ||
;; | ||
stop ) | ||
execute "${DOCKER_COMPOSE_COMMAND} -f compose.yml stop" | ||
;; | ||
login ) | ||
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} exec -it -u user ${PROJECT_NAME} //bin//bash" | ||
;; | ||
push ) | ||
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} push ${DOCKER_IMAGE_NAME}" | ||
;; | ||
build ) | ||
execute "${DOCKER_COMPOSE_COMMAND} -f ${DOCKER_COMPOSE_CONFIG} build" | ||
;; | ||
remove ) | ||
if [ "$2" == "force" ] | ||
then | ||
execute "${DOCKER_COMPOSE_COMMAND} -f compose.yml down -t 30 -v" | ||
else | ||
echo "Are you sure? This removes ALL docker volumes and all Adamant Example data! (1-Yes / 2-No)" | ||
select yn in "Yes" "No"; do | ||
case $yn in | ||
Yes ) execute "${DOCKER_COMPOSE_COMMAND} -f compose.yml down -t 30 -v"; break;; | ||
No ) exit;; | ||
esac | ||
done | ||
fi | ||
;; | ||
* ) | ||
usage $0 | ||
;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: adamant_example | ||
services: | ||
adamant_example: | ||
container_name: ${DOCKER_CONTAINER_NAME} | ||
volumes: | ||
- type: bind | ||
source: ../../adamant | ||
target: /home/user/adamant | ||
- type: bind | ||
source: ../../adamant_example | ||
target: /home/user/adamant_example | ||
extra_hosts: | ||
- host.docker.internal:host-gateway | ||
network_mode: host | ||
image: ${DOCKER_IMAGE_NAME} | ||
command: sleep infinity |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.