test: 로그 추가 #22
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
name: Docker Image CD | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Github Actions IP | |
id: ip | |
run: | | |
echo "ipv4=`dig TXT +short o-o.myaddr.l.google.com @ns1.google.com`" >> "$GITHUB_OUTPUT" | |
- name: Setup Java JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 17 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Build the server | |
run: | | |
./enable_environment.sh | |
- id: commit | |
uses: pr-mpt/actions-commit-hash@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{secrets.DOCKER_HUB_USERNAME}} | |
password: ${{secrets.DOCKER_HUB_PASSWORD}} | |
- name: Build and push | |
env: | |
TAG: ${{ env.GITHUB_SHA }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{secrets.DOCKER_HUB_USERNAME}}/${{ vars.REPOSITORY_NAME }}:latest, ${{secrets.DOCKER_HUB_USERNAME}}/${{ vars.REPOSITORY_NAME }}:${{ steps.commit.outputs.short }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: AWS Secrets Manager GitHub Action | |
uses: aws-actions/[email protected] | |
with: | |
secret-ids: dev/esc/chat/task_definition | |
- name: task definition to file | |
run: | | |
echo '${{ env.DEV_ESC_CHAT_TASK_DEFINITION }}' >> task_definition.json | |
- name: Amazon ECS "Deploy Task Definition" Action for GitHub Actions | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: task_definition.json | |
service: ${{ vars.SERVICE_NAME }} | |
cluster: ${{ vars.CLUSTER_NAME }} | |
wait-for-service-stability: true | |
wait-for-minutes: 10 |