diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml
new file mode 100644
index 0000000..3ce6fa5
--- /dev/null
+++ b/.github/workflows/gradle-build.yml
@@ -0,0 +1,77 @@
+# This workflow uses actions that are not certified by GitHub.
+# They are provided by a third-party and are governed by
+# separate terms of service, privacy policy, and support
+# documentation.
+# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
+
+# Workflow 이름
+name: Spring Boot & Gradle CI/CD
+
+on:
+ push:
+ branches: [ "main" ]
+# pull_request:
+# branches: [ "main" ]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ # JDK 17 설치
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+
+ # github secret 환경변수로 적어둔 APPLICATION_YML으로 application.yml파일을 생성합니다.
+ # 환경변수가 지나치게 많아짐을 방지하기 위해 APPLICATION_YML 변수를 만들었습니다.
+ - name: make application.yml
+ run: |
+ cd ./src/main/resources
+ touch ./application.yml
+ echo "${{ secrets.APPLICATION_YML }}" >> ./application.yml
+ shell: bash
+
+ # gradlew에 실행 권한을 부여합니다.
+ - name: Grant execute permisson for gradlew
+ run: chmod +x gradlew
+
+ # test는 CI 과정에서 수행되므로 여기서는 `-x`로 테스트를 생략했습니다.
+ # `--stacktrace`로 더 자세한 로그가 출력되게 해줍니다.
+ - name: Build with Gradle (without Test)
+ run: ./gradlew clean build -x test --stacktrace
+
+ # docker hub에 로그인하고 이미지를 빌드합니다. 이후에 push를 진행합니다.
+ # docker_username을 적지 않으면 push 시에 요청이 거부될 수 있습니다.
+ - name: Docker Hub build & push
+ run: |
+ docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
+ docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} .
+ docker images
+ docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
+
+ # EC2에 접속하고 배포합니다.
+ - name: Deploy
+ uses: appleboy/ssh-action@master
+ with:
+ host: ${{ secrets.EC2_HOST }}
+ username: ${{ secrets.EC2_USERNAME }}
+ key: ${{ secrets.EC2_KEY }}
+ port: ${{ secrets.EC2_SSH_PORT }}
+
+ script: |
+ sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
+ sudo docker rm -f $(sudo docker ps -qa)
+
+ sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
+ sudo docker run -d -p 8081:8081 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
+
diff --git a/.gitignore b/.gitignore
index 87a9836..91dab9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,9 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-# User-specific stuff
+application.yml
+
+# User-specific situff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9abdd62..3f7765a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,11 @@
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 182e646..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules/UserService.iml b/.idea/modules/UserService.iml
deleted file mode 100644
index 016b0d1..0000000
--- a/.idea/modules/UserService.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f12503c..5b449ab 100644
--- a/build.gradle
+++ b/build.gradle
@@ -66,6 +66,9 @@ dependencies {
//test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
+
+ // Jasypt: DB 암호화
+ implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.5'
}
dependencyManagement {
diff --git a/build/classes/java/main/com/example/UserService/UserServiceApplication.class b/build/classes/java/main/com/example/UserService/UserServiceApplication.class
index b4876f8..7524608 100644
Binary files a/build/classes/java/main/com/example/UserService/UserServiceApplication.class and b/build/classes/java/main/com/example/UserService/UserServiceApplication.class differ
diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin
index 6dd9f3d..44b4f0a 100644
Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml
deleted file mode 100644
index 989d139..0000000
--- a/src/main/resources/application-local.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-server:
- port: 8081
-
-spring:
- config:
- activate:
- on-profile: local
-
- application:
- name: User-Service
-
- data:
- redis:
- host: localhost
- port: 6379
-
- jpa:
- database: postgresql
- hibernate:
- dialect: org.hibernate.dialect.PostgresSQLDialect
- hibernate.ddl-auto: create
- show-sql: true
- properties:
- hibernate.format_sql: true
-
- datasource:
- hikari:
- maximum-pool-size: 4
- url: jdbc:postgresql://localhost:5432/ice_users
- username: postgres
- password: test12
- driver-class-name: org.postgresql.Driver
-
- mail:
- host: smtp.gmail.com
- port: 587
- username: iceAmericano122@gmail.com
- password: dbycouqvzmlpfbqz
- properties:
- mail:
- smtp:
- auth: true
- starttls:
- enable: true
- required: true
- connection-timeout: 5000
- timeout: 5000
- write timeout: 5000
- auth-code-expiration-millis: 1800000 # 30분
-
-eureka:
- instance:
- instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
- client:
- register-with-eureka: true
- fetch-registry: true
- service-url:
- defaultZone: http://localhost:8761/eureka
-
-greeting:
- message: Welcome to the Ice-Americano Page
-
-secretKey: amazing
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
deleted file mode 100644
index 9d4015f..0000000
--- a/src/main/resources/application-prod.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-server:
- port: 8081
-
-spring:
- config:
- activate:
- on-profile: prod
-
- data:
- redis:
- host: localhost
- port: 6379
-
- application:
- name: User-Service
- datasource:
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://127.0.0.1:3306/ice_users
- username: root
- password: test1234
-
- jpa:
- show-sql: true
- hibernate:
- ddl-auto: update
- properties:
- hibernate:
- format_sql: true
-
- mail:
- host: smtp.gmail.com
- port: 587
- username: iceAmericano122@gmail.com
- password: dbycouqvzmlpfbqz
- properties:
- mail:
- smtp:
- auth: true
- starttls:
- enable: true
- required: true
- connection-timeout: 5000
- timeout: 5000
- write timeout: 5000
- auth-code-expiration-millis: 1800000 # 30분
-
-eureka:
- instance:
- instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
- client:
- register-with-eureka: true
- fetch-registry: true
- service-url:
- defaultZone: http://52.78.155.253:8761/eureka
-
-greeting:
- message: Welcome to the Ice-Americano Page
-
-secretKey: amazing
\ No newline at end of file