Skip to content

testing ci/cd pipeline #3

testing ci/cd pipeline

testing ci/cd pipeline #3

Workflow file for this run

name: CICD
on:
push:
branches: [main]
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- name: checkout source
uses: actions/checkout@v3
- name: Login to docker hub
run: docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Build docker image
run: docker build -t jayantvashisth/furniturebackend .
- name: Publish image to docker hub
run: docker push jayantvashisth/furniturebackend:latest
deploy:
needs: build
runs-on: [aws-ec2]
steps:
- name: Pull image from docker hub
run: docker pull jayantvashisth/furniturebackend
- name: Delete old container
run: docker rm -f furniture-container
- name: Run docker container
run: docker run -d -p 5000:5000 --name furniture-container jayantvashisth/furniturebackend