Skip to content

Commit

Permalink
🔀 merge pull request #8 from feature/seperate-profiles
Browse files Browse the repository at this point in the history
[Chore] 환경설정 분리
  • Loading branch information
kiwijomn authored Jan 22, 2024
2 parents bb88df3 + 21caa36 commit 10b54cb
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t gces_backend .
docker build --build-arg SPRING_PROFILES_ACTIVE=prod -t gces_backend .
docker tag gces_backend gces/gces_backend:${GITHUB_SHA::7}
docker push gces/gces_backend:${GITHUB_SHA::7}
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ARG SPRING_PROFILES_ACTIVE=prod
ENV SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE}
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul", "org.springframework.boot.loader.launch.JarLauncher"]
29 changes: 29 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
spring:
config:
activate:
on-profile: development

import:
- classpath:secret.yml

main:
allow-bean-definition-overriding: true

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

jpa:
show-sql: false
generate-ddl: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect

server:
port: 9090
26 changes: 26 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
spring:
config:
activate:
on-profile: production

main:
allow-bean-definition-overriding: true

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

jpa:
show-sql: false
generate-ddl: true
hibernate:
ddl-auto: none
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect

server:
port: 8080
33 changes: 8 additions & 25 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
server:
port: 8080

spring:
main:
allow-bean-definition-overriding: true

config:
import:
- classpath:secret.yml

datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${datasource.url}
username: ${datasource.username}
password: ${datasource.password}
profiles:
group:
dev: development
prod: production
active: dev

jpa:
show-sql: false
generate-ddl: true
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQLDialect
default:
string: default property

jwt:
secret: ${application.jwt.secret}
secret_refresh: ${application.jwt.secret_refresh}
secret_refresh: ${application.jwt.secret_refresh}

0 comments on commit 10b54cb

Please sign in to comment.