Skip to content

feat: 데이터 형식 변경 #30

feat: 데이터 형식 변경

feat: 데이터 형식 변경 #30

Workflow file for this run

name: Java CD with Gradle
on:
workflow_dispatch:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
## create application-secret.yml
- name: make application-secret.yml
run: |
mkdir -p ./api/src/main/resources
touch ./api/src/main/resources/application-secret.yml
shell: bash
- name: deliver application-secret.yml
run: echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application-secret.yaml
shell: bash
# 빌드 및 테스트 단계.
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# gradle build
- name: Build with Gradle
run: ./gradlew build -x test
# push 하기 위해 로그인
- name: Docker Hub 로그인
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_ID }}
password: ${{ secrets.DOCKER_PASSWORD }}
#도커 빌드 & 이미지 push
- name: Docker build & Push
run: |
docker build -f Dockerfile -t ${{ secrets.DOCKER_ID }}/gitbox .
docker push ${{ secrets.DOCKER_ID }}/gitbox
# Docker 파일을 홈 서버에 배포
- name: Deploy to Prod
uses: appleboy/ssh-action@master
id: deploy-prod
with:
host: ${{ secrets.HOME_SERVER_IP }}
username: tuna
password: ${{ secrets.HOME_SERVER_PASSWORD }}
port: 22
script: |
if [ ! -z "$(docker ps -q)" ]; then
docker stop $(docker ps -q)
fi
if [ ! -z "$(docker ps -aq)" ]; then
docker rm $(docker ps -aq)
fi
docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PASSWORD }}
docker pull ${{ secrets.DOCKER_ID }}/gitbox
docker network create gitbox
docker run -d \
--name redis \
--network=gitbox \
-p 6379:6379 \
redis
docker run -d \
--name gitbox-server \
--network=gitbox \
-p 1234:1234 \
-e TZ=Asia/Seoul \
${{ secrets.DOCKER_ID }}/gitbox
docker system prune -f