Skip to content

readme.md

readme.md #32

Workflow file for this run

name: CI/CD Deployment
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout backend repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build Docker Image
run: |
echo "Building Docker image..."
docker build -t ${{ secrets.DOCKER_USERNAME }}/talker:latest .
echo "Docker image built successfully."
- name: Push Docker Image
run: |
echo "Pushing Docker image to Docker Hub..."
docker push ${{ secrets.DOCKER_USERNAME }}/talker:latest
echo "Docker image pushed successfully."
- name: Copy files to VPS
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: ./nginx, ./docker-compose.yml
target: /home/${{ secrets.USERNAME }}/app
debug: true
- name: Update containers
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
debug: true
script: |
set -e
echo "Starting deployment..."
cd /home/${{ secrets.USERNAME }}/app
docker compose down
docker compose pull
docker compose up -d
echo "Deployment completed successfully🚀🚀🚀"