Skip to content

update route test-3 #30

update route test-3

update route test-3 #30

name: Docker Build and Run
on:
push:
branches: [main]
jobs:
build_and_run:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Echo SSH_PRIVATE_KEY
run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > key.pem
- name: Set up SSH
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Pull from GitHub repository
run: |
ssh -o StrictHostKeyChecking=no -i "key.pem" ec2-user@ec2-44-206-239-176.compute-1.amazonaws.com 'cd /var/www/be-alta-quizislamic-ai && sudo git pull'
- name: SSH to Server, Build and Run Docker
run: |
ssh -o StrictHostKeyChecking=no -i "key.pem" ec2-user@ec2-44-206-239-176.compute-1.amazonaws.com 'cd /var/www/be-alta-quizislamic-ai/ && docker build -t docker-app-quiz-islamic-ai . && sudo docker rm -f docker-app-container || true && sudo docker run -d -p 8080:8080 --env-file .env --name docker-app-container docker-app-quiz-islamic-ai'