Skip to content

Commit

Permalink
add deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryKwon committed Aug 21, 2024
1 parent 8c99a82 commit d37a7a9
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d37a7a9

Please sign in to comment.