Skip to content

[김창우] sprint8 #391

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e11d41c
feat: application container
qwertyuiop4m Apr 10, 2025
c8e0dfd
feat: binaryContent 고도화
qwertyuiop4m Apr 11, 2025
d05a8e7
refactor: 멀티 스테이지
qwertyuiop4m Apr 14, 2025
a914ca6
feat: CI/CD
qwertyuiop4m Apr 14, 2025
dc6077a
refactor: 오타 수정
qwertyuiop4m Apr 14, 2025
e6885a4
refactor: 오타 수정
qwertyuiop4m Apr 14, 2025
9502eed
refactor: 권한 설정
qwertyuiop4m Apr 14, 2025
cbaba5f
refactor: login 설정
qwertyuiop4m Apr 14, 2025
97df812
feat: render
qwertyuiop4m Apr 14, 2025
9fc8367
refactor: 파일 위치 변경
qwertyuiop4m Apr 14, 2025
e506c22
refactor: task definition 등록
qwertyuiop4m Apr 14, 2025
b2beb4c
feat: 수동 버튼 추가
qwertyuiop4m Apr 14, 2025
cc74aad
feat: port 설정
qwertyuiop4m Apr 14, 2025
df8e6ef
feat: port 설정
qwertyuiop4m Apr 14, 2025
ff1d5e5
feat: 태스크 설정
qwertyuiop4m Apr 14, 2025
87ec38d
feat: 태스크 설정, port 수정
qwertyuiop4m Apr 14, 2025
363cc0e
feat: 태스크
qwertyuiop4m Apr 14, 2025
26461cc
feat: 포트 설정
qwertyuiop4m Apr 14, 2025
b45d3e8
refactor: 테스크 수정(프리티어)
qwertyuiop4m Apr 14, 2025
6f31815
CI test
qwertyuiop4m Apr 14, 2025
506b750
CI test
qwertyuiop4m Apr 14, 2025
d1f7b97
CI test
qwertyuiop4m Apr 14, 2025
895b92c
CI test2
qwertyuiop4m Apr 14, 2025
b78a357
CI test
qwertyuiop4m Apr 14, 2025
1382329
CI test
qwertyuiop4m Apr 14, 2025
fb37371
CI test
qwertyuiop4m Apr 14, 2025
39a8f72
sprint8
qwertyuiop4m Apr 14, 2025
3b05c95
sprint8
qwertyuiop4m Apr 14, 2025
07fc674
sprint8
qwertyuiop4m Apr 14, 2025
134fc8c
sprint8
qwertyuiop4m Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/build
/.gradle

.idea
*.iml

.git
.gitignore

.DS_Store
*.log
*.db
.env

!gradlew
!gradlew.bat
5 changes: 5 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
AWS_S3_ACCESS_KEY=test
AWS_S3_SECRET_KEY=test
AWS_S3_REGION=ap-northeast-2
AWS_S3_BUCKET=test-bucket
AWS_S3_PRESIGNED_URL_EXPIRATION=600
82 changes: 82 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CD - Deploy to ECS

on:
push:
branches:
- release
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
IMAGE_TAG: ${{ github.sha }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials (for ECR)
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: us-east-1

- name: Login to Public ECR
run: |
aws ecr-public get-login-password --region us-east-1 \
| docker login --username AWS --password-stdin public.ecr.aws

- name: Build and Push Docker Image
run: |
docker build -t ${{ vars.ECR_REPOSITORY_URI }}:latest \
-t ${{ vars.ECR_REPOSITORY_URI }}:${{ env.IMAGE_TAG }} .
docker push ${{ vars.ECR_REPOSITORY_URI }}:latest
docker push ${{ vars.ECR_REPOSITORY_URI }}:${{ env.IMAGE_TAG }}

- name: Configure AWS credentials (for ECS)
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ vars.AWS_REGION }}

- name: Render ECS task definition
id: render-task
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ecs/task-definition.json
container-name: discodeit-app
image: ${{ vars.ECR_REPOSITORY_URI }}:${{ env.IMAGE_TAG }}

- name: Register new ECS task definition
id: register-task
run: |
TASK_DEF_ARN=$(aws ecs register-task-definition \
--cli-input-json file://${{ steps.render-task.outputs.task-definition }} \
--query 'taskDefinition.taskDefinitionArn' --output text)
echo "TASK_DEF_ARN=$TASK_DEF_ARN" >> $GITHUB_ENV

- name: Scale service to 0 (stop current task)
run: |
aws ecs update-service \
--cluster ${{ vars.ECS_CLUSTER }} \
--service ${{ vars.ECS_SERVICE }} \
--desired-count 0
sleep 30

- name: Deploy new ECS task definition with count 1
run: |
aws ecs update-service \
--cluster ${{ vars.ECS_CLUSTER }} \
--service ${{ vars.ECS_SERVICE }} \
--task-definition ${{ env.TASK_DEF_ARN }} \
--desired-count 1

- name: Wait for ECS service to stabilize
run: |
aws ecs wait services-stable \
--cluster ${{ vars.ECS_CLUSTER }} \
--services ${{ vars.ECS_SERVICE }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI-Test

on:
push:
branches: [ '**' ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Grant execute permission to Gradle
run: chmod +x gradlew

- name: Build and Test with Gradle
run: ./gradlew clean test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ build/
out/
!**/src/main/**/out/
!**/src/test/**/out/
*.yaml
application-prod.yaml
.env
*.logs
### Eclipse ###
.apt_generated
Expand Down
8 changes: 0 additions & 8 deletions .idea/gradle.xml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitignore에 .idea가 있는데도 불구하고 제외가 안되나 보네요!
아래 글 보시겠어요?
https://coding-groot.tistory.com/59

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading