Skip to content

Commit

Permalink
Merge pull request #126 from bas-kirill/bugfix/deploy-update-docker-c…
Browse files Browse the repository at this point in the history
…ompose

fix(dev): update docker compose
  • Loading branch information
bas-kirill authored Aug 26, 2024
2 parents bfbf380 + 5216ea4 commit a1a720c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 27 deletions.
22 changes: 11 additions & 11 deletions tools/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
# platforms:
# - "linux/amd64"
# - "linux/arm64"
container_name: muse-server
container_name: "${MUSE_SERVER_IMAGE:-muse-server}"
ports:
- ${SERVER_PORT}:8080
- ${SERVER_DEBUG_PORT}:5005
Expand All @@ -45,16 +45,16 @@ services:
postgres:
condition: service_healthy

muse-client:
image: "${MUSE_CLIENT_IMAGE:-muse-client}"
# platforms:
# - "linux/amd64"
# - "linux/arm64"
container_name: muse-client
ports:
- ${CLIENT_PORT}:80
networks:
- muse
# muse-client:
# image: "${MUSE_CLIENT_IMAGE:-muse-client}"
## platforms:
## - "linux/amd64"
## - "linux/arm64"
# container_name: "${MUSE_CLIENT_IMAGE:-muse-client}"
# ports:
# - ${CLIENT_PORT}:80
# networks:
# - muse

# muse-client-dev:
# image: "${MUSE_CLIENT_DEV_IMAGE:-muse-client-dev}"
Expand Down
4 changes: 2 additions & 2 deletions tools/docker/env/dev.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SERVER_PORT=50505
SERVER_PORT=10001
SERVER_DEBUG_PORT=50504

CLIENT_PORT=50001
CLIENT_DEV_PORT=3001
CLIENT_DEV_PORT=3003

POSTGRES_PORT=5555
POSTGRES_USER=muse
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/env/local.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SERVER_PORT=8080
SERVER_PORT=9000
SERVER_DEBUG_PORT=5005

CLIENT_PORT=3000
Expand Down
12 changes: 6 additions & 6 deletions tools/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ if [ -z "$SSH_PASS" ]; then
exit 1
fi

dockerRepository=$1
stage=$1

if [ -z "$1" ]
then
echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m"
dockerRepository="myshx"
echo -e "\033[0;33mNo stage provided. 'DEV' stage will be used.\033[0m"
stage="dev"
fi

stage=$2
dockerRepository=$2

if [ -z "$2" ]
then
echo -e "\033[0;33mNo stage provided. 'DEV' stage will be used.\033[0m"
stage="dev"
echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m"
dockerRepository="myshx"
fi

dockerTag="$stage-$(git rev-parse --short HEAD)"
Expand Down
32 changes: 27 additions & 5 deletions tools/scripts/runLocal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,32 @@ set -e
currentDir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
rootDir="$currentDir/../../"

(cd "$rootDir" && exec ./tools/scripts/stop.sh)
(cd "$rootDir" && exec ./tools/scripts/clean.sh)
(cd "$rootDir" && exec ./tools/scripts/buildAndPush.sh)
(cd "$rootDir" && exec ./tools/scripts/run.sh)
stage=$1

dockerTag="latest"
if [ -z "$1" ]
then
echo -e "\033[0;33mNo stage provided. 'local' stage will be used.\033[0m"
stage="local"
dockerTag="$stage-$(git rev-parse --short HEAD)"
fi

dockerRepository=$2

if [ -z "$2" ]
then
echo -e "\033[0;33mNo Docker Hub username provided. 'myshx' will be used.\033[0m"
dockerRepository="myshx"
fi

(cd "$rootDir" && exec ./tools/scripts/stop.sh "$stage")
(cd "$rootDir" && exec ./tools/scripts/clean.sh "$stage")
(cd "$rootDir" && exec ./tools/scripts/buildAndPush.sh "$dockerRepository" "$dockerTag")

MUSE_SERVER_IMAGE="$dockerRepository/muse-server:$dockerTag"
MUSE_CLIENT_IMAGE="$dockerRepository/muse-client:$dockerTag"
MUSE_CLIENT_DEV_IMAGE="$dockerRepository/muse-client-dev:$dockerTag"
(cd "$rootDir" && exec ./tools/scripts/run.sh "$stage")

echo -e "\033[0;32mList of available ports:\n\033[0m"
(cd "$rootDir" && exec cat ./tools/docker/env/local.env)
(cd "$rootDir" && exec cat ./tools/docker/env/$stage.env)
3 changes: 1 addition & 2 deletions tools/scripts/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ if [ -z "$1" ]
stage="local"
fi


(cd "$rootDir" && exec docker compose \
-f ./tools/docker/docker-compose.yml \
--env-file ./tools/docker/env/$stage.env \
--project-name=muse-$stage \
rm -f)
down -v)

echo -e "\033[0;32mDocker Service has been stopped.\033[0m"

0 comments on commit a1a720c

Please sign in to comment.