Skip to content

Commit

Permalink
🚀 deploy config update
Browse files Browse the repository at this point in the history
Related:
  • Loading branch information
L-U-Ready committed Nov 11, 2024
1 parent ea28d24 commit 69ab6da
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,29 @@ jobs:
run: |
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Connect to EC2 and deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ec2-user
key_path: ~/.ssh/id_rsa
key: ${{ secrets.EC2_SSH_KEY }}
script: |
# Install Docker if not installed
if ! command -v docker &> /dev/null; then
echo "Installing Docker..."
sudo apt-get update -y
sudo apt-get install -y docker.io
sudo apt update
sudo apt install -y docker.io
sudo systemctl start docker
sudo usermod -aG docker ec2-user
fi
# Install Docker Compose if not installed
if ! command -v docker-compose &> /dev/null; then
echo "Installing Docker Compose..."
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '\"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
echo "Stopping and removing any existing application container..."
docker-compose -f /home/ec2-user/your_project_folder/docker-compose.yml down || true
echo "Pulling the latest Docker image..."
Expand Down

0 comments on commit 69ab6da

Please sign in to comment.