Skip to content

Commit

Permalink
Merge pull request #699 from hngprojects/team-deploy
Browse files Browse the repository at this point in the history
ci: add scripts to boilerplate
  • Loading branch information
Ravencodess authored Jul 28, 2024
2 parents 05238d8 + 709596a commit e16d8dc
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/dev_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 {next|remix}"
exit 1
fi

if [ "$1" == "next" ]; then
cd /home/nextjs/dev/hng_boilerplate_nextjs
git pull origin dev
docker compose -f docker/development/docker-compose.yml build
docker compose -f docker/development/docker-compose.yml up -d
elif [ "$1" == "remix" ]; then
cd /home/remixjs/dev/hng_boilerplate_remix
git pull origin dev
docker compose -f docker/development/docker-compose.yml build
docker compose -f docker/development/docker-compose.yml up -d
else
echo "Invalid argument. Use 'next' or 'remix'."
echo "Usage: $0 {next|remix}"
exit 1
fi

22 changes: 22 additions & 0 deletions scripts/prod_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 {next|remix}"
exit 1
fi

if [ "$1" == "next" ]; then
cd /home/nextjs/prod/hng_boilerplate_nextjs
git pull origin main
docker compose -f docker/prod/docker-compose.yml build
docker compose -f docker/prod/docker-compose.yml up -d
elif [ "$1" == "remix" ]; then
cd /home/remixjs/prod/hng_boilerplate_remix
git pull origin main
docker compose -f docker/prod/docker-compose.yml build
docker compose -f docker/prod/docker-compose.yml up -d
else
echo "Invalid argument. Use 'next' or 'remix'."
echo "Usage: $0 {next|remix}"
exit 1
fi
22 changes: 22 additions & 0 deletions scripts/staging_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 {next|remix}"
exit 1
fi

if [ "$1" == "next" ]; then
cd /home/nextjs/staging/hng_boilerplate_nextjs
git pull origin staging
docker compose -f docker/staging/docker-compose.yml build
docker compose -f docker/staging/docker-compose.yml up -d
elif [ "$1" == "remix" ]; then
cd /home/remixjs/staging/hng_boilerplate_remix
git pull origin staging
docker compose -f docker/staging/docker-compose.yml build
docker compose -f docker/staging/docker-compose.yml up -d
else
echo "Invalid argument. Use 'next' or 'remix'."
echo "Usage: $0 {next|remix}"
exit 1
fi
25 changes: 25 additions & 0 deletions scripts/team_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e

# Check if the team name is provided
if [ -z "$1" ]; then
echo "Error: Team name is required."
echo "Usage: $0 [team name] [port]"
exit 1
fi

# Check if the port is provided
if [ -z "$2" ]; then
echo "Error: Port number is required."
echo "Usage: $0 [team name] [port]"
exit 1
fi

# Assign arguments to variables for clarity
TEAM_NAME=$1
PORT=$2

git pull origin dev
docker pull hngdevops/nextjs-boilerplate:dev
docker run -d --name "$TEAM_NAME" -p "$PORT:3000" hngdevops/nextjs-boilerplate:dev

0 comments on commit e16d8dc

Please sign in to comment.