refactored deployment phase
This commit is contained in:
@@ -84,11 +84,22 @@ jobs:
|
|||||||
ssh-add ~/.ssh/id_ed25519
|
ssh-add ~/.ssh/id_ed25519
|
||||||
ssh-keyscan -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
|
ssh-keyscan -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Copy tar to server
|
- name: Copy files to server
|
||||||
run: |
|
run: |
|
||||||
|
# Copy image tar
|
||||||
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} \
|
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} \
|
||||||
demo-app.tar \
|
demo-app.tar \
|
||||||
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:'${{ secrets.DEPLOY_PATH }}/demo-app.tar'
|
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/demo-app.tar"
|
||||||
|
|
||||||
|
# Copy docker-compose file
|
||||||
|
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} \
|
||||||
|
docker-compose.yml \
|
||||||
|
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/docker-compose.yml"
|
||||||
|
|
||||||
|
# Copy nginx config directory (used as volume in docker-compose.yml)
|
||||||
|
scp -o StrictHostKeyChecking=no -P ${{ secrets.SERVER_PORT }} -r \
|
||||||
|
nginx_user_conf.d \
|
||||||
|
${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:"${{ secrets.DEPLOY_PATH }}/nginx_user_conf.d"
|
||||||
|
|
||||||
- name: Deploy on server
|
- name: Deploy on server
|
||||||
run: |
|
run: |
|
||||||
@@ -106,9 +117,16 @@ jobs:
|
|||||||
# Load the new image from the tarball
|
# Load the new image from the tarball
|
||||||
docker load -i demo-app.tar
|
docker load -i demo-app.tar
|
||||||
|
|
||||||
|
# Make sure we actually have a compose file here
|
||||||
|
if [ ! -f docker-compose.yml ]; then
|
||||||
|
echo "ERROR: docker-compose.yml not found in \$(pwd)" >&2
|
||||||
|
ls -la
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Restart the compose stack
|
# Restart the compose stack
|
||||||
docker compose down
|
docker compose -f docker-compose.yml down
|
||||||
docker compose --env-file .env up -d --remove-orphans
|
docker compose -f docker-compose.yml --env-file .env up -d --remove-orphans
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm demo-app.tar
|
rm demo-app.tar
|
||||||
|
|||||||
Reference in New Issue
Block a user