update dockerhub to new repo #7
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash --login {0} | |
steps: | |
- name: Use Node.js version 20 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.x' | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build frontend | |
run: | | |
docker build -t meharasahabandu/ctse-frontend:latest ./frontend | |
- name: Build backend | |
run: | | |
docker build -t meharasahabandu/ctse-event-service-backend:latest ./backend/event-service | |
- name: Login to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u meharasahabandu --password-stdin | |
- name: Push frontend image to Docker Hub | |
run: docker push meharasahabandu/ctse-frontend:latest | |
- name: Push backend image to Docker Hub | |
run: docker push meharasahabandu/ctse-event-service-backend:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Use Node.js version 20 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.x' | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u meharasahabandu --password-stdin | |
- name: Pull frontend image from Docker Hub | |
run: docker pull meharasahabandu/ctse-frontend:latest | |
- name: Pull backend image from Docker Hub | |
run: docker pull meharasahabandu/ctse-event-service-backend:latest | |
- name: Tag and push frontend image to Docker Hub | |
run: | | |
docker tag meharasahabandu/ctse-frontend:latest meharasahabandu/ctse-frontend:latest | |
docker push meharasahabandu/ctse-frontend:latest | |
- name: Tag and push backend image to Docker Hub | |
run: | | |
docker tag meharasahabandu/ctse-event-service-backend:latest meharasahabandu/ctse-event-service-backend:latest | |
docker push meharasahabandu/ctse-event-service-backend:latest |