-
Notifications
You must be signed in to change notification settings - Fork 4
전체 프로젝트 코드 대신 빌드한 JAR 파일만 AWS 에 배포하기 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ name: Deploy to Amazon EC2 | |
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - push-only-jar-file-to-s3 | ||
|
|
||
| env: | ||
| AWS_REGION: ap-northeast-2 | ||
|
|
@@ -38,6 +38,10 @@ jobs: | |
| with: | ||
| arguments: clean build -x test | ||
|
|
||
| # (3.5) 빌드한 JAR 파일 복사 | ||
| - name: Copy Jar file | ||
| run: cp ./build/libs/*.jar ./deploy/spring-webapp.jar | ||
|
Comment on lines
+41
to
+43
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Github Actions 에서 build 파일을 미리 복사합니다. |
||
|
|
||
| # (4) AWS 인증 (IAM 사용자 Access Key, Secret Key 활용) | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v1 | ||
|
|
@@ -53,7 +57,7 @@ jobs: | |
| --application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \ | ||
| --ignore-hidden-files \ | ||
| --s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \ | ||
| --source . | ||
| --source ./deploy | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| # (6) S3 버킷에 있는 파일을 대상으로 CodeDeploy 실행 | ||
| - name: Deploy to AWS EC2 from S3 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,6 @@ DEPLOY_LOG="$PROJECT_ROOT/deploy.log" | |
|
|
||
| TIME_NOW=$(date +%c) | ||
|
|
||
| # build 파일 복사 | ||
| echo "$TIME_NOW > $JAR_FILE 파일 복사" >> $DEPLOY_LOG | ||
| cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE | ||
|
|
||
|
Comment on lines
-12
to
-15
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Github Actions 워크플로우에서 JAR 파일을 복사했습니다. |
||
| # jar 파일 실행 | ||
| echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG | ||
| nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG & | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main브랜치와 구분하기 위해 현재 브랜치를 기준으로 Github Actions 수행