Skip to content

DEV 배포

DEV 배포 #21

Workflow file for this run

name: DEV 배포
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: dev
name: build image
steps:
- name: get repo from github
uses: actions/checkout@v3
- name: setup jdk17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle Ready
run: chmod +x gradlew
- name: Gradle Build
run: ./gradlew clean build -x test
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/familynote:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/familynote:latest
deploy:
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- name: Deploy to NCP
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
password: ${{ secrets.NCP_PASSWORD }}
port: ${{ secrets.NCP_PORT }}
script: |
sudo docker-compose -f /root/docker-compose.yml pull
sudo docker-compose -f /root/docker-compose.yml up -d
sudo docker run -d ${{ secrets.DOCKER_USERNAME }}/familynote:latest