Initial commit

This commit is contained in:
cedrictech-internal
2026-03-26 13:21:38 +08:00
commit fb770a593d
6 changed files with 92 additions and 0 deletions

27
deploy/deploy.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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"

10
deploy/docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
services:
web:
image: prj-001-demo:latest
build:
context: ..
dockerfile: Dockerfile
container_name: prj-001-demo-web
restart: always
ports:
- "21001:80"

View File

@@ -0,0 +1,7 @@
location /p/PRJ-001/ {
proxy_pass http://127.0.0.1:21001/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}