Skip to content

deploy: ECR 배포 스크립트 수정 #2

deploy: ECR 배포 스크립트 수정

deploy: ECR 배포 스크립트 수정 #2

Workflow file for this run

name: Build and Push Docker Image to ECR
on:
push:
branches:
- main
env:
AWS_REGION: ${{ env.AWS_REGION }}

Check failure on line 9 in .github/workflows/docker-image.yml

View workflow run for this annotation

GitHub Actions / Build and Push Docker Image to ECR

Invalid workflow file

The workflow is not valid. .github/workflows/docker-image.yml (Line: 9, Col: 15): Unrecognized named-value: 'env'. Located at position 1 within expression: env.AWS_REGION .github/workflows/docker-image.yml (Line: 10, Col: 19): Unrecognized named-value: 'env'. Located at position 1 within expression: env.AWS_ECR_REPO
ECR_REPOSITORY: ${{ env.AWS_ECR_REPO }}
jobs:
deploy:
name: Deploy to ECR
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- 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: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REPOSITORY:latest $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"