Feat/alpha env #12
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: Build Alpha Image | |
on: | |
# push: | |
pull_request: | |
branches: [ develop ] | |
paths: backend/** | |
permissions: | |
id-token: write | |
jobs: | |
push-image: | |
defaults: | |
run: | |
working-directory: backend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: check jar file | |
run: ls -l build/libs | |
- name: Build Image | |
run: docker build . | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section | |
with: | |
role-to-assume: arn:aws:iam::791335373803:role/AWSPushImageToECR | |
aws-region: ap-northeast-2 | |
- name: Amazon ECR "Login" Action for GitHub Actions | |
uses: aws-actions/[email protected] | |
- name: push ECR | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: zipgo/alpha-backend | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG |