Update readme.md #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build and push Docker images | |
run: | | |
docker build -t gautampatil1/lofipomo-client client/ | |
docker build -t gautampatil1/lofipomo-server server/ | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
docker push gautampatil1/lofipomo-client | |
docker push gautampatil1/lofipomo-server | |
install-docker-and-docker-compose: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: installing docker, docker-compose and cloudfared. | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME}} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
script: | | |
sudo apt-get update -y | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo apt-get update -y | |
sudo apt-get install docker-compose-plugin -y | |
sudo docker compose version | |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb && sudo cloudflared service install eyJhIjoiMjI2NjMwOTIxNjc3ZTkxNTEzNmYxMzgyNmExMjg1NTEiLCJ0IjoiZmMxMDdkYjYtMGM5Zi00YTU2LTljNjctZTgzY2RlNWUxNjg3IiwicyI6IllUWTNOMlUyWmpRdFpXSTROUzAwTnpaaUxXRTNZVGN0WkRFMVpXVTRZamczT1dGayJ9 | |
cd $GITHUB_WORKSPACE # Change to the repository directory | |
ls -l | |
# Assuming your docker-compose.yml is in the root of the repository | |
curl -O -L https://raw.githubusercontent.com/GautamPatil1/lofipomo-2/master/docker-compose.yml | |
sudo docker compose down -v # Stop and remove containers, networks, and volumes | |
sudo docker compose pull # Pull the latest images | |
sudo docker compose up -d # Start the containers in | |