Skip to content

Commit

Permalink
feat : CI/CD 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
SolfE committed Sep 26, 2024
1 parent 20b68df commit d129612
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 13 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/main-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy to AWS ECS

on:
push:
branches: [ "main" ]
branches: [ "main", "feat/CICD" ]

jobs:
build:
Expand All @@ -20,6 +20,15 @@ jobs:
java-version: '17'
distribution: 'adopt'

- name: Set yml file
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-prod.yml
env:
spring.datasource.url: ${{ secrets.MYSQL_URL }}
spring.datasource.username: ${{ secrets.MYSQL_USERNAME }}
spring.datasource.password: ${{ secrets.MYSQL_PASSWORD }}

- name: Build with Gradle
run: |
chmod +x ./gradlew
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ WORKDIR /app

COPY ${JAR_PATH} /app/app.jar

CMD ["java", "-jar", "/app/app.jar"]
CMD ["java", "-jar", "-Dspring.profiles.active=prod", "/app/app.jar"]
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java:8.0.33'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 로컬 설정 파일

spring:
datasource:
driver-class-name: org.h2.Driver
url: 'jdbc:h2:mem:test'
username: username
password: password

h2:
console:
enabled: true
path: /h2-console
12 changes: 12 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 배포 설정 파일

spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}

jpa:
hibernate:
ddl-auto: update
12 changes: 1 addition & 11 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
spring:
datasource:
driver-class-name: org.h2.Driver
url: 'jdbc:h2:mem:test'
username: username
password: password

h2:
console:
enabled: true
path: /h2-console
# 공통 설정 파일

0 comments on commit d129612

Please sign in to comment.