From d37a7a92a9f2b1bcd717a38e7fe3bb9c218a2a73 Mon Sep 17 00:00:00 2001 From: LarryKwon <65128957+LarryKwon@users.noreply.github.com> Date: Thu, 22 Aug 2024 03:59:54 +0900 Subject: [PATCH] add deploy.sh --- deploy.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..6c094fc --- /dev/null +++ b/deploy.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +usage() { + echo "Usage: $0 -e value" + echo " -e: 현재 배포 환경을 입력하세요. (prod, dev, local)" +} + +NODE_ENV="" + +while getopts "e:" opt; do + case $opt in + e) + NODE_ENV=$OPTARG + echo "NODE_ENV: $NODE_ENV" + if [ "$NODE_ENV" == "prod" ]; then + docker-compose -f docker/docker-compose.prod.yml up -d + elif [ "$NODE_ENV" == "dev" ]; then + docker-compose -f docker/docker-compose.dev.yml up -d + elif [ "$NODE_ENV" == "local" ]; then + docker-compose -f docker/docker-compose.local.yml up -d + else + echo "Invalid environment: $NODE_ENV" 1>&2 + usage + exit 1 + fi + ;; + \?) + echo "Invalid option: -$OPTARG" 1>&2 + usage + exit 1 + ;; + esac +done + +if [ -z "$NODE_ENV" ]; then + echo "Error: Environment option is required." + usage + exit 1 +fi