CORS 해제 설정 적용 #15
Workflow file for this run
This file contains hidden or 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 Publish (Prod ARM) | |
| # 태그 기반 push | |
| on: | |
| push: | |
| tags: | |
| - 'v.*' # 예시 v.250930 | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| # 1. Checkout the repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Debug workspace | |
| run: ls ./ | |
| # 2. Set up JDK 17 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'corretto' | |
| # 3. Cache Gradle dependencies | |
| - name: Cache Gradle dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| # 4. Grant execute permission to gradlew | |
| - name: Grant execute permission to gradlew | |
| run: chmod +x ./gradlew | |
| # 5. Get Code Artifact token | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Get and save Auth Token for CodeArtifact | |
| id: get-save-codeartifact-auth-token | |
| run: | | |
| aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact-auth-token | |
| - name: Export CodeArtifact Auth Token | |
| run: | | |
| echo "CODEARTIFACT_AUTH_TOKEN=$(cat .codeartifact-auth-token)" >> $GITHUB_ENV | |
| # 6. Build the application with Gradle | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| env: | |
| codeArtifactAuthToken: ${{ env.CODEARTIFACT_AUTH_TOKEN }} | |
| # 7. Log in to Amazon ECR | |
| - name: Log in to Amazon ECR | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| # 8. Build and push arm64 image | |
| - name: Build and push ARM64 Docker image | |
| run: | | |
| docker buildx build \ | |
| --build-arg JAR_FILE=build/libs/*.jar \ | |
| -t ${{ secrets.ECR_URI }}/internhasha-prod/internhasha-server:${{ github.ref_name }} \ | |
| --push \ | |
| . | |
| # deploy: | |
| # runs-on: ubuntu-latest | |
| # needs: build-and-push | |
| # | |
| # steps: | |
| # | |
| # # 1. Checkout the repository | |
| # - name: Checkout repository | |
| # uses: actions/checkout@v3 | |
| # | |
| # - name: Check workspace files | |
| # run: ls -al ${GITHUB_WORKSPACE} | |
| # | |
| # # 1. Send docker-compose.prod.yml to EC2 server | |
| # - name: Copy docker-compose files to EC2 | |
| # uses: appleboy/scp-action@master | |
| # with: | |
| # host: ${{ secrets.EC2_HOST }} | |
| # username: ${{ secrets.EC2_USER }} | |
| # key: ${{ secrets.EC2_PRIVATE_KEY }} | |
| # source: "./docker-compose.prod.yml" | |
| # target: "/home/ubuntu" | |
| # debug: true | |
| # | |
| # # 2. Deploy to EC2 via SSH | |
| # - name: Deploy to EC2 | |
| # uses: appleboy/ssh-action@master | |
| # with: | |
| # host: ${{ secrets.EC2_HOST }} | |
| # username: ${{ secrets.EC2_USER }} | |
| # key: ${{ secrets.EC2_PRIVATE_KEY }} | |
| # script: | | |
| # cd ~ | |
| # docker-compose --env-file .env -f docker-compose.prod.yml down | |
| # docker-compose --env-file .env -f docker-compose.prod.yml pull | |
| # docker image prune -f | |
| # docker-compose --env-file .env -f docker-compose.prod.yml up --build -d | |
| # debug: true |