Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[init] 배포 세팅 #2

Merged
merged 5 commits into from
Jul 4, 2024
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
50 changes: 50 additions & 0 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: develop-CD
on:
push:
branches: [ "develop" ]

jobs:
ci:
runs-on: ubuntu-22.04
env:
working-directory: .


steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}

- name: docker login
uses: docker/[email protected]

- name: login docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.DOCKER_LOGIN_ACCESSTOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-dev
push: true
tags: ${{ secrets.DOCKER_LOGIN_USERNAME }}/${{ secrets.DEV_REPONAME }}

cd:
needs: ci
runs-on: ubuntu-22.04

steps:
- name: docker container run
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEV_SERVER_IP }}
username: ${{ secrets.DEV_SERVER_USER }}
key: ${{ secrets.DEV_SERVER_KEY }}
script: |
cd ~
./deploy.sh
28 changes: 28 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: develop-CI

on:
pull_request:
branches: [ "develop" ]

jobs:
build:
runs-on: ubuntu-22.04

steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.SUBMODULE_TOKEN }}

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

- name: build
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ out/
### VS Code ###
.vscode/

application.yml
application.yml
application-local.yml
application-dev.yml
application-prod.yml
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "SERVER_YML"]
path = SERVER_YML
url = https://github.com/OMZigak/SERVER_YML.git
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM amd64/amazoncorretto:17
WORKDIR /app
COPY ./build/libs/server-0.0.1-SNAPSHOT.jar /app/KKUM-SERVER.jar
CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "KKUM-SERVER.jar"]
1 change: 1 addition & 0 deletions SERVER_YML
Submodule SERVER_YML added at 44dc7c
36 changes: 33 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,45 @@ repositories {
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// Spring
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

// Lombok
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'

// Database
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
// testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// CI/CD health check
implementation 'org.springframework.boot:spring-boot-starter-actuator'

// AWS S3
implementation("software.amazon.awssdk:bom:2.21.0")
implementation("software.amazon.awssdk:s3:2.21.0")

// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'

// Validation
implementation 'org.springframework.boot:spring-boot-starter-validation'
}

tasks.named('test') {
useJUnitPlatform()
}

tasks.register('copyYml', Copy) {
from './SERVER_YML'
include '*'
into 'src/main/resources'
}
Loading