Skip to content

edit connection, build backend only #36

edit connection, build backend only

edit connection, build backend only #36

Workflow file for this run

name: Deploy to EC2 from Develop
on:
push:
branches:
- BE-20-connect-to-AWS
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
ref: BE-20-connect-to-AWS
- name: Executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_PRIVATE_KEY }}
port: ${{ secrets.AWS_PORT }}
script: |
set -x
cd app/backend-internship
git checkout BE-20-connect-to-AWS
git pull origin BE-20-connect-to-AWS
echo "PORT=${{ secrets.PORT }}" > .env
echo "HOST=${{ secrets.HOST }}" >> .env
echo "NODE_ENV=${{ secrets.NODE_ENV }}" >> .env
echo "DB_CONNECTION=${{ secrets.DB_CONNECTION }}" >> .env
echo "DB_USERNAME=${{ secrets.DB_USERNAME }}" >> .env
echo "DB_PASSWORD=${{ secrets.DB_PASSWORD }}" >> .env
echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env
echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env
echo "DB_HOST=${{ secrets.DB_HOST }}" >> .env
echo "ACCESS_SECRET_KEY=${{ secrets.ACCESS_SECRET_KEY }}" >> .env
echo "REFRESH_SECRET_KEY=${{ secrets.REFRESH_SECRET_KEY }}" >> .env
echo "ACTION_SECRET_KEY=${{ secrets.ACTION_SECRET_KEY }}" >> .env
echo "AUTH0_AUDIENCE=${{ secrets.AUTH0_AUDIENCE }}" >> .env
echo "AUTH0_ISSUER_URL=${{ secrets.AUTH0_ISSUER_URL }}" >> .env
echo "REDIS_URL=${{ secrets.REDIS_URL }}" >> .env
echo "AUTH0_JWKS_URL=${{ secrets.AUTH0_JWKS_URL }}" >> .env
docker stop backend-prod || true
docker rm backend-prod || true
docker rmi backend-image-prod || true
docker build -t backend-image-prod --progress=plain --no-cache --target prod .
docker run -d -p 3002:3002 --name backend-prod backend-image-prod