File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed
Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 1414 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
1515 DOCKER_DEV_REPO : ${{ secrets.DOCKER_DEV_REPO }}
1616 CONTAINER_PORT_DEV : ${{ secrets.CONTAINER_PORT_DEV }}
17+ ACTIVE_PROFILE : ' dev'
1718 steps :
1819 - name : 리포지토리를 가져옵니다
1920 uses : actions/checkout@v4
Original file line number Diff line number Diff line change 1414 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
1515 DOCKER_DEV_REPO : ${{ secrets.DOCKER_TEST_REPO }}
1616 CONTAINER_PORT_DEV : ${{ secrets.CONTAINER_PORT_DEV }}
17+ ACTIVE_PROFILE : ' test'
1718 steps :
1819 - name : 리포지토리를 가져옵니다
1920 uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -91,20 +91,34 @@ tasks.register('copySecret', Copy) {
9191 into(' src/main/resources' )
9292}
9393
94- def dockerUser = System . getenv(' DOCKER_USERNAME' )
95- def dockerImage = System . getenv(' DOCKER_DEV_REPO' )
96- def containerPort = System . getenv(' CONTAINER_PORT_DEV' )
94+ project. ext {
95+ dockerUser = System . getenv(' DOCKER_USERNAME' )
96+ activeProfile = System . getenv(' ACTIVE_PROFILE' ) ?: ' dev'
97+ containerPort = System . getenv(' CONTAINER_PORT' ) ?: ' 8081'
98+ }
99+
100+
101+ def getDockerImage () {
102+ switch (activeProfile) {
103+ case ' dev' :
104+ return System . getenv(' DOCKER_DEV_REPO' )
105+ case ' test' :
106+ return System . getenv(' DOCKER_TEST_REPO' )
107+ default :
108+ return System . getenv(' DOCKER_DEV_REPO' )
109+ }
110+ }
97111
98112jib {
99113 from {
100114 image = ' eclipse-temurin:21-jre-alpine'
101115 }
102116 to {
103- image = " ${ dockerUser} /${ dockerImage } "
104- tags = [' latest' ]
117+ image = " ${ dockerUser} /${ getDockerImage() } "
118+ tags = [" latest" ]
105119 }
106120 container {
107- jvmFlags = [' -Dspring.profiles.active=dev ' , ' -Dfile.encoding=UTF-8' ]
121+ jvmFlags = [" -Dspring.profiles.active=${ activeProfile } " , ' -Dfile.encoding=UTF-8' ]
108122 ports = [containerPort]
109123 }
110124}
You can’t perform that action at this time.
0 commit comments