Skip to content

Test actions commit

Test actions commit #2

Workflow file for this run

name: CD Pipeline
on:
push:
branches:
- action
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker image build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: backend
- name: Deploy Application
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.REMOTE_KEY }}
script: |
echo "### Change directory to Sasimee-Back ###"
cd /home/opc/Sasimee-Back
echo "### Pull origin main from github ###"
git pull origin main
echo "### Pull new image from dockerhub###"
sudo docker compose build backend
echo "### Shutdown existing container ###"
sudo docker compose down
echo "### Turn on new container ###"
sudo docker compose up -d