From 2750484eec266f9706df698030541d68d20284ac Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Fri, 15 Dec 2023 15:25:31 -0500 Subject: [PATCH] feat(bastion): move Bastion setup to task model fix: Dockerfile name --- .../Dockerfile-bastion-app} | 0 services/bastion/build.sh | 5 +++++ services/bastion/constants.sh | 6 ++++++ services/bastion/start.sh | 12 ++++++++++++ services/bastion/stop.sh | 5 +++++ 5 files changed, 28 insertions(+) rename services/{Dockerfile-bastion => bastion/Dockerfile-bastion-app} (100%) create mode 100644 services/bastion/build.sh create mode 100644 services/bastion/constants.sh create mode 100644 services/bastion/start.sh create mode 100644 services/bastion/stop.sh diff --git a/services/Dockerfile-bastion b/services/bastion/Dockerfile-bastion-app similarity index 100% rename from services/Dockerfile-bastion rename to services/bastion/Dockerfile-bastion-app diff --git a/services/bastion/build.sh b/services/bastion/build.sh new file mode 100644 index 0000000..c1c8dbc --- /dev/null +++ b/services/bastion/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source constants.sh + +docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-bastion-app . diff --git a/services/bastion/constants.sh b/services/bastion/constants.sh new file mode 100644 index 0000000..6a11f1c --- /dev/null +++ b/services/bastion/constants.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +export APP_NAME="bastion" +export APP_CONTAINER_NAME=$APP_NAME-app +export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME +export NETWORK_NAME=$APP_NAME-local diff --git a/services/bastion/start.sh b/services/bastion/start.sh new file mode 100644 index 0000000..9127429 --- /dev/null +++ b/services/bastion/start.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +source constants.sh + +docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" + +docker run \ + --detach \ + --network $NETWORK_NAME \ + --name $APP_CONTAINER_NAME \ + --env-file $ENV_FILE_DIR/bastion.env \ + $APP_IMAGE_NAME:dev diff --git a/services/bastion/stop.sh b/services/bastion/stop.sh new file mode 100644 index 0000000..871ff06 --- /dev/null +++ b/services/bastion/stop.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source constants.sh + +docker rm -f $APP_CONTAINER_NAME