From 037cf0adba8a6aaab9b15af630ee9b1674a991fd Mon Sep 17 00:00:00 2001 From: mjas0006 Date: Sat, 7 Sep 2024 19:49:32 +1000 Subject: [PATCH] Simplifying docker compose scripts --- ...ompose.backend.yml => docker-compose.backend-only.yml | 0 ....frontend.yml => docker-compose.frontend-dev-mode.yml | 0 docker-compose.yml => docker-compose.fullstack.yml | 0 scripts/backend-only-restart.sh | 6 ++++++ scripts/backend-only-start.sh | 3 +++ scripts/backend-restart.sh | 9 --------- scripts/backend-start.sh | 3 --- scripts/clean-containers.sh | 9 --------- scripts/cleanup-all-containers.sh | 9 +++++++++ scripts/frontend-dev-mode-start.sh | 3 +++ scripts/fullstack-restart.sh | 6 ++++++ scripts/fullstack-start.sh | 3 +++ scripts/restart-containers.sh | 9 --------- scripts/start-containers.sh | 3 --- scripts/start-frontend-test-containers.sh | 3 --- 15 files changed, 30 insertions(+), 36 deletions(-) rename docker-compose.backend.yml => docker-compose.backend-only.yml (100%) rename docker-compose.frontend.yml => docker-compose.frontend-dev-mode.yml (100%) rename docker-compose.yml => docker-compose.fullstack.yml (100%) create mode 100755 scripts/backend-only-restart.sh create mode 100755 scripts/backend-only-start.sh delete mode 100755 scripts/backend-restart.sh delete mode 100755 scripts/backend-start.sh delete mode 100755 scripts/clean-containers.sh create mode 100755 scripts/cleanup-all-containers.sh create mode 100644 scripts/frontend-dev-mode-start.sh create mode 100755 scripts/fullstack-restart.sh create mode 100755 scripts/fullstack-start.sh delete mode 100755 scripts/restart-containers.sh delete mode 100755 scripts/start-containers.sh delete mode 100644 scripts/start-frontend-test-containers.sh diff --git a/docker-compose.backend.yml b/docker-compose.backend-only.yml similarity index 100% rename from docker-compose.backend.yml rename to docker-compose.backend-only.yml diff --git a/docker-compose.frontend.yml b/docker-compose.frontend-dev-mode.yml similarity index 100% rename from docker-compose.frontend.yml rename to docker-compose.frontend-dev-mode.yml diff --git a/docker-compose.yml b/docker-compose.fullstack.yml similarity index 100% rename from docker-compose.yml rename to docker-compose.fullstack.yml diff --git a/scripts/backend-only-restart.sh b/scripts/backend-only-restart.sh new file mode 100755 index 0000000..4dc74dd --- /dev/null +++ b/scripts/backend-only-restart.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Stop and remove containers, networks, and volumes +docker compose -f docker-compose.backend-only.yml down -v + +docker compose -f docker-compose.backend-only.yml up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/backend-only-start.sh b/scripts/backend-only-start.sh new file mode 100755 index 0000000..75c9510 --- /dev/null +++ b/scripts/backend-only-start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f docker-compose.backend-only.yml up --force-recreate --build -d diff --git a/scripts/backend-restart.sh b/scripts/backend-restart.sh deleted file mode 100755 index ca4d323..0000000 --- a/scripts/backend-restart.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Stop and remove containers, networks, and volumes -docker compose down -v - -# Optionally, remove dangling volumes not associated with any container -docker volume prune -f - -docker compose -f docker-compose.backend.yml up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/backend-start.sh b/scripts/backend-start.sh deleted file mode 100755 index 1837be5..0000000 --- a/scripts/backend-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker compose -f docker-compose.backend.yml up --force-recreate --build -d diff --git a/scripts/clean-containers.sh b/scripts/clean-containers.sh deleted file mode 100755 index e0bf2ec..0000000 --- a/scripts/clean-containers.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Stop and remove containers, networks, and volumes -docker compose down -v -docker compose -f docker-compose.frontend.yml down -v -docker compose -f docker-compose.backend.yml down -v - -# Optionally, remove dangling volumes not associated with any container -docker volume prune -f diff --git a/scripts/cleanup-all-containers.sh b/scripts/cleanup-all-containers.sh new file mode 100755 index 0000000..baee7ec --- /dev/null +++ b/scripts/cleanup-all-containers.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Stop and remove containers, networks, and volumes +docker compose -f docker-compose.fullstack.yml down -v +docker compose -f docker-compose.frontend-dev.yml down -v +docker compose -f docker-compose.backend-only.yml down -v + +# Optionally, remove dangling volumes not associated with any container +docker volume prune -f diff --git a/scripts/frontend-dev-mode-start.sh b/scripts/frontend-dev-mode-start.sh new file mode 100644 index 0000000..6a508ce --- /dev/null +++ b/scripts/frontend-dev-mode-start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f ./docker-compose.frontend-dev-mode.yml up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/fullstack-restart.sh b/scripts/fullstack-restart.sh new file mode 100755 index 0000000..3846dda --- /dev/null +++ b/scripts/fullstack-restart.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Stop and remove containers, networks, and volumes +docker compose -f docker-compose.fullstack.yml down -v + +docker compose -f docker-compose.fullstack.yml up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/fullstack-start.sh b/scripts/fullstack-start.sh new file mode 100755 index 0000000..39e8f9c --- /dev/null +++ b/scripts/fullstack-start.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose -f docker-compose.fullstack.yml up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/restart-containers.sh b/scripts/restart-containers.sh deleted file mode 100755 index a5cf7d7..0000000 --- a/scripts/restart-containers.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Stop and remove containers, networks, and volumes -docker compose down -v - -# Optionally, remove dangling volumes not associated with any container -docker volume prune -f - -docker compose up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/start-containers.sh b/scripts/start-containers.sh deleted file mode 100755 index 4eb61e1..0000000 --- a/scripts/start-containers.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker compose up --force-recreate --build -d \ No newline at end of file diff --git a/scripts/start-frontend-test-containers.sh b/scripts/start-frontend-test-containers.sh deleted file mode 100644 index 5b67c28..0000000 --- a/scripts/start-frontend-test-containers.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker compose -f ./docker-compose.frontend.yml up --force-recreate --build -d \ No newline at end of file