Add build job
1. stage 내용 수정하기
.gitlab.yml)
에서
Build and Push
stage를 정의했었다.
새로운 브랜치를 만들고 .gitlab.yml
을 수정해보자.
git checkout -b feature/build-push-pipeline
- 수정 전
Build and Push:
stage: Build and Push
script:
- echo "Build and Push Docker Image"
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|production)$/'
- 수정 후
Build and Push:
image: docker:20.10.0
services:
- docker:20.10.0-dind
stage: Build and Push
script:
- apk add python3 py-pip
- pip3 install awscli==1.18.8
- docker build --compress -t $ECR_REPO:$CI_COMMIT_SHORT_SHA .
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker push $ECR_REPO:$CI_COMMIT_SHORT_SHA
- docker tag $ECR_REPO:$CI_COMMIT_SHORT_SHA $ECR_REPO:latest
- docker push $ECR_REPO:latest
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|production)$/'
지난번과 마찬가지로 gitlab이 제공하는 포맷 validate 기능을 활용해보자.
Author And Source
이 문제에 관하여(Add build job), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@khh180cm/Add-build-job저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)