Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Luxshan2000 committed Sep 28, 2023
2 parents 3daa128 + 4917bc3 commit 49b9da2
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CICD Backend

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 image
run: docker build -t luxshan/aws-pipeline .
- name: Publish image to docker hub
run: docker push luxshan/aws-pipeline:latest

deploy:
needs: build
runs-on: [aws-ec2]
steps:
- name: Pull image from docker hub
run: docker pull luxshan/aws-pipeline
- name: Delete old container
run: docker rm -f aws-pipeline-container
- name: Run docker container
run: docker run -d -p 3000:3000 --name aws-pipeline-container luxshan/aws-pipeline
32 changes: 32 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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 image
run: docker build -t luxshan/aws-pipeline.
- name: Publish image to docker hub
run: docker push luxshan/aws-pipeline:latest

deploy:
needs: build
runs-on: [aws-ec2]
steps:
- name: Pull image from docker hub
run: docker pull luxshan/aws-pipeline:latest
- name: Delete old container
run: docker rm -f aws-pipeline-container
- name: Run docker container
run: docker run -d -p 3000:3000 --name aws-pipeline-container luxshan/aws-pipeline

0 comments on commit 49b9da2

Please sign in to comment.