Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

자동 배포 추가 #167

Merged
merged 3 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/dev-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build docker image on push to develop

on:
push:
branches: ["develop"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . -f Dockerfile -t ghcr.io/sparcs-kaist/zabo-front:dev
- name: Log in to DockerHub
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin
- name: Push the Docker image
run: docker push ghcr.io/sparcs-kaist/zabo-front:dev
31 changes: 31 additions & 0 deletions .github/workflows/dev-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy to dev server

# when dev image build action is completed, run this action
on:
workflow_run:
workflows: ["Build docker image on push to develop"]
types:
- completed

jobs:
if_workflow_success:
name: Deploy to dev server
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
proxy_host: ${{ secrets.PROXY_HOST }}
proxy_port: ${{ secrets.PROXY_PORT }}
proxy_username: ${{ secrets.PROXY_USERNAME }}
proxy_password: ${{ secrets.PROXY_PASSWORD }}
script: |
docker pull ghcr.io/sparcs-kaist/zabo-front:dev
docker rm -f zabo-front
docker run --restart always -d -p 15081:80 --name zabo-front ghcr.io/sparcs-kaist/zabo-front:dev