Skip to content

Commit

Permalink
cd: docker 이용한 배포 플로우 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjooon2 committed Feb 11, 2025
1 parent 9282415 commit 21d1cd9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Frontend

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: .
push: true
file: ./Dockerfile
platforms: linux/amd64
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/frontend:${{ github.run_number }}
${{ secrets.DOCKER_HUB_USERNAME }}/frontend:latest
deploy:
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/ubuntu && ./deploy-frontend.sh

0 comments on commit 21d1cd9

Please sign in to comment.