GithubAction에서 master 푸시시 ECR에 이미지를 푸시
5470 단어 GitHubActions도커ECRGitHub
aws ECR에 리포지토리 만들기


Github Actions를 이동하는 액세스 키, 비밀 키 획득

4. 이름에 「github-actions」(이름은 임의의 이름으로 괜찮습니다!) 액세스의 종류는 「프로그램에 의한 액세스」에 체크해 다음에

5.「기존의 정책을 직접 첨부」를 선택→「AmazonEC2ContainerRegistryPowerUser」라고 검색하면 권한이 나오므로 이쪽을 체크


Github에 비밀 키 등록
test
)
위와 같이 변수를 지정하여
${{ secrets.キー名 }}
로 설정하여 환경 변수를 사용할 수 있습니다 github actions의 yml 만들기
.github/workflows/config.ymlname: Build and Push
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-18.04
timeout-minutes: 300
steps:
- uses: actions/checkout@v1
- 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: ap-northeast-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPO_NAME }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
확인!
name: Build and Push
on:
push:
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-18.04
timeout-minutes: 300
steps:
- uses: actions/checkout@v1
- 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: ap-northeast-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPO_NAME }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
상기 4점이 생기면
github로 푸시 해 보면 github actions가 움직임 리포지토리에 image가 푸시되면 완료됩니다.

참고문헌
GitHub Action에서 Docker 컨테이너를 빌드하고 Amazon ECR에 저장
Reference
이 문제에 관하여(GithubAction에서 master 푸시시 ECR에 이미지를 푸시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/takehanKosuke/items/306be392421c6e0a1764
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(GithubAction에서 master 푸시시 ECR에 이미지를 푸시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/takehanKosuke/items/306be392421c6e0a1764텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)