Skip to content

Commit

Permalink
🚀 add production deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Estebans441 committed Nov 18, 2024
1 parent d95add9 commit 9908308
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy PROD
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
Deploy:
name: Deploy on PROD
runs-on: self-hosted
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_G1_HOST }}
username: ${{ secrets.HOSTS_USERNAME }}
key: ${{ secrets.PROD_G1_SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd AllConnected/${{ github.event.repository.name }}
echo "Fetching latest code..."
git fetch
git checkout main
git pull
echo "Building Docker image..."
docker build -t ${{ github.event.repository.name }} .
echo "Creating .env file..."
echo "PROFILE=prod1" >> .env
echo "CONFIG_IP=10.43.101.72" >> .env
docker rm -f ${{ github.event.repository.name }}
docker run --name ${{ github.event.repository.name }} --network all_connected -d -p ${{ secrets.SERVICE_PORT }}:8080 --env-file .env ${{ github.event.repository.name }}
echo "Docker container running..."
rm .env

0 comments on commit 9908308

Please sign in to comment.