Skip to content
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
63 changes: 63 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CD

on:
push:
branches: [ "develop" ]

jobs:
dev-build-TEST:
runs-on: ubuntu-24.04

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: application.yml 작성
run: |
cd src/main/resources

echo "${{ secrets.APPLICATION }}" > ./application-deploy.yml
echo "${{ secrets.DATA }}" > ./data.sql

cat ./application-deploy.yml

- name: build
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash

- name: docker build 가능하도록 환경 설정
uses: docker/[email protected]

- name: docker hub 로그인
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }}

- name: docker image 빌드 및 푸시
run: |
docker build --platform linux/amd64 -t sfaas/server .
docker push sfaas/server

deploy-cd:
needs: ci
runs-on: ubuntu-24.04

steps:
- name: docker 컨테이너 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.RELEASE_SERVER_IP }}
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.RELEASE_SERVER_KEY }}
script: |
cd ~
./deploy.sh
34 changes: 34 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
branches: [ "develop" ]

jobs:
build:
runs-on: ubuntu-24.04

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: application.yml 작성
run: |
cd src/main/resources

echo "${{ secrets.APPLICATION }}" > ./application-deploy.yml
echo "${{ secrets.DATA }}" > ./data.sql

cat ./application-deploy.yml

- name: build
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM amd64/amazoncorretto:17

WORKDIR /app

COPY ./build/libs/server-0.0.1-SNAPSHOT.jar /app/SFaaS.jar

CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=deploy", "SFaaS.jar"]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
Expand Down