Files
workbench/deploy/deploy.sh
cedrictech-internal fb770a593d Initial commit
2026-03-26 13:21:38 +08:00

28 lines
596 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
PROJECT_CODE="PRJ-001"
BASE_DIR="/srv/projects/${PROJECT_CODE}"
REPO_DIR="${BASE_DIR}/repo"
NGINX_LOC_DIR="/etc/nginx/project_locations.d"
NGINX_TARGET="${NGINX_LOC_DIR}/${PROJECT_CODE}.conf"
echo "==> Deploy ${PROJECT_CODE}"
mkdir -p "${BASE_DIR}"
mkdir -p "${NGINX_LOC_DIR}"
cd "${REPO_DIR}"
echo "==> Build and start containers"
docker compose -f deploy/docker-compose.yml up -d --build
echo "==> Install nginx route"
cp deploy/nginx.location.conf "${NGINX_TARGET}"
echo "==> Test and reload nginx"
nginx -t
systemctl reload nginx
echo "==> Done"