Skip to content

Commit

Permalink
updated deploy.yml to use nextblog:2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mizanmahi committed Sep 24, 2024
1 parent 880c3cb commit 4f33abc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
# Step 3: Build the Docker image
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:1.0 .
docker build -t ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:2.0 .
# Step 4: Push Docker image to DockerHub
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:1.0
docker push ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:2.0
# Step 5: SSH to EC2 and deploy the Docker container
- name: Deploy to EC2
Expand All @@ -41,7 +41,7 @@ jobs:
port: 22
script: |
# Pull the latest image
sudo docker pull ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:1.0
sudo docker pull ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:2.0
# Check if the container is running and stop/remove it if it exists
if [ "$(sudo docker ps -a -q -f name=nextblog)" ]; then
Expand All @@ -52,4 +52,4 @@ jobs:
# Run the container
echo "Starting a new container..."
sudo docker run -d --name nextblog --env-file .env -p 9000:5000 ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:1.0
sudo docker run -d --name nextblog --env-file .env -p 9000:5000 ${{ secrets.DOCKERHUB_USER_NAME }}/nextblog:2.0

0 comments on commit 4f33abc

Please sign in to comment.