AWS CLI 설치
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"sudo installer -pkg AWSCLIV2.pkg -target /
AWS 계정 설정
aws configureAWS 토큰 발급
aws ecr get-login-password --region ap-northeast-2
AWS_ECR_REGISTRY: AWS ECR Registry 주소(리포지토리 경로 제외)AWS_ACCESS_KEY_ID: AWS 액세스 키 IDAWS_SECRET_ACCESS_KEY: AWS 시크릿 액세스 키CLOUDTYPE_TOKEN: 클라우드타입 API 키
name: Create and publish a Docker image to AWS ECR, Deploy to Cloudtypeon:
push:
branches:
- mainenv:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY }}IMAGE_NAME: [이미지명]jobs:
build-and-push-image:
runs-on: ubuntu-latestpermissions:
contents: readsteps:
- name: Checkout repositoryuses: actions/checkout@v3
- name: Log in to the Container registryuses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.AWS_ACCESS_KEY_ID }}password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Extract metadata (tags, labels) for Dockerid: metauses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}tags: | type=sha - name: Build and push Docker imageuses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}
- name: Deploy to Cloudtypeuses: cloudtype-github-actions/deploy@v1with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}project: [스페이스명]/[프로젝트명]stage: mainyaml: | name: [서비스명] app: container options: ports: [포트번호] image: ${{ steps.meta.outputs.tags }}GAR_REGISTRY: Artifact Registry 주소GAR_JSON_KEY: Artifact Registry 서비스 계정 JSON KEYCLOUDTYPE_TOKEN: 클라우드타입 API 키
name: Create and publish a Docker image to GCP Artifact Registry, Deploy to Cloudtypeon:
push:
branches:
- mainenv:
REGISTRY: ${{ secrets.GAR_REGISTRY }}IMAGE_NAME: [이미지명]jobs:
build-and-push-image:
runs-on: ubuntu-latestpermissions:
contents: readsteps:
- name: Checkout repositoryuses: actions/checkout@v3
- name: Log in to the Container registryuses: docker/login-action@v2with:
registry: ${{ env.REGISTRY }}username: _json_keypassword: ${{ secrets.GAR_JSON_KEY }}
- name: Extract metadata (tags, labels) for Dockerid: metauses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}tags: | type=sha - name: Build and push Docker imageuses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}
- name: Deploy to Cloudtypeuses: cloudtype-github-actions/deploy@v1with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}project: [스페이스명]/[프로젝트명]stage: mainyaml: | name: [서비스명] app: container options: ports: [포트번호] image: ${{ steps.meta.outputs.tags }}