Skip to content

Commit

Permalink
Merge pull request #137 from eod940/047-GITHUB-ACTIONS
Browse files Browse the repository at this point in the history
refactor: [047-GITHUB-ACTIONS] Github-actions를 이용한 CI 환경 구축
  • Loading branch information
eod940 committed Mar 4, 2024
2 parents 6caa79a + 9f6c50a commit 5ac56a8
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 19 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches: [ "master" ]

# 개발서버 구축 이후 pr 오픈
# pull_request:
# branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:

Expand All @@ -15,37 +17,48 @@ jobs:
runs-on: ubuntu-latest

steps:
# 1. Java 17 세팅:
- name: My First Checkout
uses: actions/checkout@v3

# 1. Java 17 세팅:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 2. Gradle 세팅
- name: Init Gradle
uses: gradle/gradle-build-action@v1
with:
gradle-version: 7.6.1
# 2. application.yml 파일 생성
- name: make application.yml
run: |
# application.yml 파일 생성
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_PROD }}" >> ./application.yml
shell: bash

# 3. Gradle Build를 위한 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# 3. Tweaver 빌드하기
# 4. Tweaver 빌드하기
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: clean bootJar
run: ./gradlew clean build --exclude-task test

# 4. Docker image 빌드하기
# 5. Docker image 빌드하기
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag github-actions/tweaver
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_ID }}/tweaver

# 5. Docker 로그인 하기
# 6. Docker 로그인 하기
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_ID }}
password: ${{ secrets.DOCKERHUB_PW }}

# 6. Docker 푸시하기
# 7. Docker 푸시하기
- name: docker Hub push
run: docker push github-action/tweaver
run: docker push ${{ secrets.DOCKERHUB_ID }}/tweaver
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ out/
logs

application-secret.properties
/src/main/resources/application.yml
#/src/main/resources/application.yml
107 changes: 107 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
server:
port: 8080

spring:
application:
name: tweaver

mvc:
pathmatch:
matching-strategy: ant_path_matcher

jpa:
hibernate:
ddl-auto: update
use-new-id-generator-mappings: false
show-sql: true
defer-datasource-initialization: true
properties:
hibernate:
format_sql: true
show_sql: true
highlight_sql: true
open-in-view: true

datasource:
url: ${DB_URL}
username: ${DB_USER}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 10

profiles:
include: secret

redis:
host: ${IP_ADDRESS}
port: 6379

security:
oauth2:
client:
registration:
kakao:
client-id: ${kakao-client-id}
client-secret: ${kakao-client-secret}
scope:
- profile_nickname
- profile_image
- account_email
- gender
- age_range
client-name: Kakao
authorization-grant-type: authorization_code
client-authentication-method: POST
redirect-uri: https://valuewith.site/oauth2/callback/kakao

provider:
kakao:
authorization-uri: https://kauth.kakao.com/oauth/authorize
token-uri: https://kauth.kakao.com/oauth/token
user-info-uri: https://kapi.kakao.com/v2/user/me
user-name-attribute: id

freemarker:
cache: false

jackson:
serialization:
fail-on-empty-beans: false

main:
allow-bean-definition-overriding: true

cloud:
aws:
s3:
bucket: ${S3_BUCKET_NAME}
credentials:
access-key: ${S3_ACCESS_KEY}
secret-key: ${S3_SECRET_KEY}
region:
static: ap-northeast-2
auto: false
stack:
auto: false

cloud front:
distribution:
domain: ${CLOUD_FRONT_NAME}

kakao-rest-api-key: ${kakao-rest-api-key}

app:
oauth2:
authorizedRedirectUris:
- https://tweaver.vercel.app/oauth2/kakao

logging:
level:
com.zaxxer.hikari.HikariConfig: DEBUG
com.zaxxer.hikari: TRACE
org:
hibernate:
type:
descriptor:
sql: trace

0 comments on commit 5ac56a8

Please sign in to comment.