Skip to content

CICD : 무중단 배포 구축 #60

CICD : 무중단 배포 구축

CICD : 무중단 배포 구축 #60

Workflow file for this run

name: Zerozero Server CICD
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew clean build
- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_ACCESS_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
dockerfile: Dockerfile
push: true
tags: ${{secrets.DOCKER_USERNAME}}/zerozero:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{secrets.HOST}}
username: ubuntu
key: ${{secrets.PEM_KEY}}
script: |
chmod 777 /home/ubuntu/docker/deploy.sh
./deploy.sh
docker image prune -f