修改
This commit is contained in:
22
deploy/post-receive
Normal file
22
deploy/post-receive
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Sample post-receive hook for bare repository deployment.
|
||||
# Adjust paths and user permissions as needed.
|
||||
|
||||
set -e
|
||||
REPO_DIR="/srv/njts-accounting/repo.git"
|
||||
WORK_TREE="/srv/njts-accounting/app"
|
||||
COMPOSE_FILE="/srv/njts-accounting/docker-compose.yml"
|
||||
|
||||
echo "Deploy hook triggered"
|
||||
mkdir -p "$WORK_TREE"
|
||||
|
||||
# checkout latest to work tree
|
||||
GIT_DIR="$REPO_DIR" git --work-tree="$WORK_TREE" checkout -f
|
||||
|
||||
cd "$WORK_TREE"
|
||||
|
||||
echo "Building and restarting containers..."
|
||||
docker compose -f "$COMPOSE_FILE" pull --ignore-pull-failures || true
|
||||
docker compose -f "$COMPOSE_FILE" up -d --build --remove-orphans
|
||||
|
||||
echo "Deployment finished"
|
||||
Reference in New Issue
Block a user