Skip to content

Commit

Permalink
feat: Add cicd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
junseublim committed Jun 23, 2024
1 parent ec98c26 commit 4ce701e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to AWS EC2

on:
push:
branches:
- feature/deploy

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build docker image
run: docker build -t sonny2024/polabo-fe .
- name: Login to DockerHub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Push to DockerHub
run: docker push sonny2024/polabo-fe:latest

deploy:
needs: build
runs-on: ip-172-31-6-84

steps:
- name: Pull from DockerHub
run: docker pull sonny2024/polabo-fe:latest
- name: Delete existing container
run: docker rm -f polabo-fe || true
- name: Run container
run: docker run -d -p 80:80 --name polabo-fe sonny2024/polabo-fe:latest

0 comments on commit 4ce701e

Please sign in to comment.