File tree Expand file tree Collapse file tree 3 files changed +10
-26
lines changed
Expand file tree Collapse file tree 3 files changed +10
-26
lines changed Original file line number Diff line number Diff line change 1313 env :
1414 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
1515 DOCKER_DEV_REPO : ${{ secrets.DOCKER_DEV_REPO }}
16- CONTAINER_PORT_DEV : ${{ secrets.CONTAINER_PORT_DEV }}
16+ CONTAINER_PORT : ${{ secrets.CONTAINER_PORT_DEV }}
1717 steps :
1818 - name : 리포지토리를 가져옵니다
1919 uses : actions/checkout@v4
Original file line number Diff line number Diff line change 1212 runs-on : ubuntu-latest
1313 env :
1414 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
15- DOCKER_DEV_REPO : ${{ secrets.DOCKER_TEST_REPO }}
16- CONTAINER_PORT_DEV : ${{ secrets.CONTAINER_PORT_DEV }}
15+ DOCKER_TEST_REPO : ${{ secrets.DOCKER_TEST_REPO }}
16+ CONTAINER_PORT : ${{ secrets.CONTAINER_PORT_DEV }}
1717 steps :
1818 - name : 리포지토리를 가져옵니다
1919 uses : actions/checkout@v4
4646 runs-on : ubuntu-latest
4747 env :
4848 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
49- DOCKER_DEV_REPO : ${{ secrets.DOCKER_TEST_REPO }}
49+ DOCKER_TEST_REPO : ${{ secrets.DOCKER_TEST_REPO }}
5050 steps :
5151 - name : AWS Credentials 설정
5252 uses : aws-actions/configure-aws-credentials@v4
5555 aws-secret-access-key : ${{ secrets.AWS_SECRET_KEY }}
5656 aws-region : ap-northeast-2
5757
58- - name : 개발 서버 배포
58+ - name : 테스트 서버 배포
5959 uses : appleboy/ssh-action@v1.0.3
6060 with :
6161 host : ${{ secrets.TEST_AWS_EC2_PUBLIC_IP }}
Original file line number Diff line number Diff line change @@ -91,34 +91,18 @@ tasks.register('copySecret', Copy) {
9191 into(' src/main/resources' )
9292}
9393
94- project. ext {
95- dockerUser = System . getenv(' DOCKER_USERNAME' )
96- containerPort = System . getenv(' CONTAINER_PORT' ) ?: ' 8081'
97- activeProfile = System . getProperty(' spring.profiles.active' ) ?: System . getenv(' ACTIVE_PROFILE' ) ?: ' dev'
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- }
94+ def isTestEnvironment = System . getenv(' DOCKER_TEST_REPO' ) != null
11195
11296jib {
11397 from {
11498 image = ' eclipse-temurin:21-jre-alpine'
11599 }
116100 to {
117- image = " ${ dockerUser } / ${ getDockerImage() } "
118- tags = [" latest" ]
101+ image = System . getenv( ' DOCKER_USERNAME ' ) + ' / ' + (isTestEnvironment ? System . getenv( ' DOCKER_TEST_REPO ' ) : System . getenv( ' DOCKER_DEV_REPO ' ))
102+ tags = [' latest' ]
119103 }
120104 container {
121- jvmFlags = [" -Dspring.profiles.active=${ activeProfile } " , ' -Dfile.encoding=UTF-8' ]
122- ports = [containerPort ]
105+ jvmFlags = [" -Dspring.profiles.active=${ isTestEnvironment ? 'test' : 'dev' } " , ' -Dfile.encoding=UTF-8' ]
106+ ports = [' 8081 ' ]
123107 }
124108}
You can’t perform that action at this time.
0 commit comments