뽑기 로직 수정 #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Docker Vue.js | |
on: | |
push: | |
branches: [master] | |
env: | |
DOCKER_IMAGE: ghcr.io/zeropage/cz_portal_fe | |
NAME: cz_portal_fe | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.DOCKER_IMAGE }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: [self-hosted, cz-portal-fe] | |
steps: | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy with Docker Compose | |
run: | | |
# docker-compose.yml이 있는 경로로 이동 | |
cd /home/ubuntu/zeropage.org | |
# 최신 이미지 받기 | |
docker compose pull cz_portal_fe | |
# 컨테이너 재시작 (새 이미지로) | |
docker compose up -d --remove-orphans | |
# 사용하지 않는 이미지 정리 (선택 사항) | |
docker image prune -f |