Skip to content

Update MONGODB_URI to MONGODB_URL in code files #12

Update MONGODB_URI to MONGODB_URL in code files

Update MONGODB_URI to MONGODB_URL in code files #12

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
jobs:
build-and-publish-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: sujalgoswami/boredtube:latest
target: production
deploy:
runs-on: ubuntu-latest
needs: build-and-publish-docker-image
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Remote SSH into VPS and deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
sudo docker pull sujalgoswami/boredtube:latest
sudo docker stop boredtube || true
sudo docker rm boredtube || true
sudo docker run --restart=always -d --name boredtube -p 8001:8000 \
-e PORT=8000 \
-e MONGODB_URL=${{ secrets.MONGODB_URL }} \
-e CORS_ORIGIN=${{ secrets.CORS_ORIGIN }} \
-e ACCESS_TOKEN_SECRET=${{ secrets.ACCESS_TOKEN_SECRET }} \
-e ACCESS_TOKEN_EXPIRY=${{ secrets.ACCESS_TOKEN_EXPIRY }} \
-e REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }} \
-e REFRESH_TOKEN_EXPIRY=${{ secrets.REFRESH_TOKEN_EXPIRY }} \
-e CLOUDINARY_CLOUD_NAME=${{ secrets.CLOUDINARY_CLOUD_NAME }} \
-e CLOUDINARY_API_KEY=${{ secrets.CLOUDINARY_API_KEY }} \
-e CLOUDINARY_API_SECRET=${{ secrets.CLOUDINARY_API_SECRET }} \
sujalgoswami/boredtube:latest