Skip to content

Merge pull request #217 from a0uda/UserFeature #234

Merge pull request #217 from a0uda/UserFeature

Merge pull request #217 from a0uda/UserFeature #234

Workflow file for this run

# CD Backend
name: CD BE
on:
push:
branches:
- main
jobs:
build_dev_test:
name: Build Backend For Dev files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Backend For Dev files
run: |
docker build -t dev-backend -f Dockerfile.dev .
- name: Run Backend For Testing Dev files
run: |
docker run --rm dev-backend
build_push_docker:
name: Build Backend For Prod files and push to docker
runs-on: ubuntu-latest
needs: build_dev_test
steps:
- uses: actions/checkout@v2
- name: Build Backend For Prod files
run: |
docker build -t aoudaa/dkr-backend:latest .
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker Backend image
run: |
docker push aoudaa/dkr-backend:latest
deploy:
name: Deploy Backend For Prod files
runs-on: ubuntu-latest
needs: build_push_docker
steps:
- name: ssh into vm and run the script
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd ~/docker
sh deployBE.sh