fix: ItemDetailDto 생성자 수정 (#400) #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backend Service | |
name: Deploy Backend Service to Amazon ECS | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'be/**' | |
env: | |
AWS_REGION: ap-northeast-2 | |
ECR_REPOSITORY: secondhand_team1_ecr | |
ECS_CLUSTER: secondhand-cs | |
ECS_SERVICE: secondhand-service-was | |
CONTAINER_NAME: was | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache JDK | |
uses: actions/cache@v2 | |
with: | |
path: ~/.sdkman/candidates/java | |
key: jdk-${{ runner.os }}-${{ hashFiles('**/*.java') }} | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Build with Gradle | |
run: | | |
cd ${{ github.workspace }}/be | |
chmod +x gradlew | |
./gradlew clean build -x test | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Docker Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
HASH=$(git log -1 --pretty=%h) | |
IMAGE_ID=$ECR_REGISTRY/secondhand_team1_ecr:be-${HASH} | |
LATEST_IMAGE_ID=$ECR_REGISTRY/secondhand_team1_ecr:be-latest | |
docker build -t $IMAGE_ID -f ${{ github.workspace }}/Dockerfile.be . | |
docker tag $IMAGE_ID $LATEST_IMAGE_ID | |
docker push $IMAGE_ID | |
docker push $LATEST_IMAGE_ID | |
echo "::set-output name=image::$IMAGE_ID" | |
- name: Get latest ECS task definition | |
id: get-latest-task-def | |
run: | | |
TASK_DEF=$(aws ecs describe-services --cluster ${ECS_CLUSTER} --services ${ECS_SERVICE} --region ${AWS_REGION} --query "services[0].taskDefinition" --output text) | |
aws ecs describe-task-definition --task-definition $TASK_DEF --region ${AWS_REGION} --query "taskDefinition" --output json > task-definition.json | |
echo "TASK_DEF_JSON=$(pwd)/task-definition.json" >> $GITHUB_ENV | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: ${{ env.TASK_DEF_JSON }} | |
container-name: ${{ env.CONTAINER_NAME }} | |
image: ${{ steps.build-image.outputs.image }} | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ env.ECS_SERVICE }} | |
cluster: ${{ env.ECS_CLUSTER }} | |
wait-for-service-stability: true |