Skip to content

Pull latest Docker image and start container #8

Pull latest Docker image and start container

Pull latest Docker image and start container #8

Workflow file for this run

name: Pull latest Docker image and start container
# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
workflow_run:
workflows: ['Create and publish a Docker image']
types: [completed]
branches:
- 'main'
jobs:
deploy-compose:
name: Deploy compose
runs-on: ubuntu-latest
steps:
- name: Deploy docker compose
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rlgoDzvc -i"
SOURCE: "deploy/app/docker-compose.yml"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "/var/data/services/test-gallowhead/"
EXCLUDE: "/dist/, /node_modules/"
SCRIPT_BEFORE: |
echo "Starting deployment ..."
if [ ! -d /var/data/services/test-gallowhead]; then
mkdir /var/data/services/test-gallowhead
fi
start-container:
name: Start container
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: cd /var/data/services/test-gallowhead && docker compose up --build -d