auth url added #25
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: Build and Deploy to Docker Hub | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./docker/Dockerfile.userApp | |
push: true | |
tags: akshatwork6/user-app-image:latest | |
- name: Verify Pushed Image | |
run: docker pull akshatwork6/user-app-image:latest | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
sudo docker pull akshatwork6/user-app-image:latest | |
sudo docker stop web-app || true | |
sudo docker rm web-app || true | |
sudo docker run -e JWT_SECRET=${{ secrets.JWT_SECRET }} \ | |
-e DATABASE_URL=${{ secrets.DATABASE_URL }} \ | |
-e GOOGLE_SECRET=${{ secrets.GOOGLE_SECRET }} \ | |
-e GOOGLE_ID=${{ secrets.GOOGLE_ID }} \ | |
-e NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} \ | |
-d --name web-app --restart unless-stopped -p 80:3000 akshatwork6/user-app-image:latest | |