backend deploy added #10
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: CICD Frontend | ||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
build: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build docker frontend image | ||
run: docker build -t luxshan/aws-pipeline-frontend ./frontend | ||
- name: Publish frontend image to docker hub | ||
run: docker push luxshan/aws-pipeline-frontend | ||
- name: Build docker backend image | ||
run: docker build -t luxshan/aws-pipeline-backend ./backend | ||
- name: Publish backend image to docker hub | ||
run: docker push luxshan/aws-pipeline-backend | ||
deploy: | ||
needs: build | ||
runs-on: [aws-ec2] | ||
steps: | ||
- name: Pull image from docker hub | ||
run: docker pull luxshan/aws-pipeline-frontend | ||
- name: Delete old container | ||
run: docker rm -f aws-pipeline-frontend-container | ||
- name: Run docker container | ||
run: docker run -d -p 3000:3000 --name aws-pipeline-frontend-container luxshan/aws-pipeline-frontend | ||
name: Pull image from docker hub | ||
Check failure on line 41 in .github/workflows/workflow.yml GitHub Actions / CICD FrontendInvalid workflow file
|
||
run: docker pull luxshan/aws-pipeline-backend | ||
- name: Delete old container | ||
run: docker rm -f aws-pipeline-backend-container | ||
- name: Run docker container | ||
run: docker run -d -p 5000:5000 --name aws-pipeline-backend-container luxshan/aws-pipeline-backend |