티스토리 뷰
[AWS] ECS 올리기 - 1. VPC (https://a-half-human-half-developer.tistory.com/158)
[AWS] ECS 올리기 - 2. ECR (https://a-half-human-half-developer.tistory.com/159)
[AWS] ECS 올리기 - 3. ALB & Target Group (https://a-half-human-half-developer.tistory.com/160)
[AWS] ECS 올리기 - 4. ECS (https://a-half-human-half-developer.tistory.com/161)
[AWS] ECS 올리기 - 5. 도메인 연결 및 SSL 인증서 적용 (https://a-half-human-half-developer.tistory.com/162)
Amazon ECR에 프라이빗 리포지토리를 생성한다.
리포지토리 이름만 지정해주면 쉽게 생성 가능하다.
생성 후 상세 페이지로 들어가면 상단 우측에 푸시 명령 보기를 따라 이미지를 올릴 수 있다.
(CICD를 구성해 CodeCommit 등 깃에서 소스를 땡겨오는 설정은 추후에 할 예정)
먼저 빌드한 이미지를 올리기 위해 AWS 계정에 로그인을 해준다.
% aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 999999999999.dkr.ecr.ap-northeast-2.amazonaws.com
Login Succeeded
빌드할 때 아규먼트로 프로파일을 dev로 설정해주었다.
% docker build -t jane-shop-apis --build-arg profile=dev .
[+] Building 1.4s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:8-jre-alpine 1.4s
=> [internal] load build context 0.0s
=> => transferring context: 123B 0.0s
=> [1/5] FROM docker.io/library/openjdk:8-jre-alpine@sha256:f362b165b870ef129cbe730f29065ff37399c0aa8bcab3e44b51c302938c9193 0.0s
=> CACHED [2/5] ADD ./build/libs/jane-shop-apis-0.0.1-SNAPSHOT.jar jane-shop-apis.jar 0.0s
=> CACHED [3/5] RUN chmod 700 jane-shop-apis.jar 0.0s
=> CACHED [4/5] RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && echo Asia/Seoul > /etc/timezone 0.0s
=> CACHED [5/5] RUN apk add --no-cache tzdata 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:f8e118d8424f64cef9bb61ed3af8634479d2c7f412f03ea31abe1bf0ad5180cd 0.0s
=> => naming to docker.io/library/jane-shop-apis 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
이미지에 태그를 걸어준다.
% docker tag jane-shop-apis:latest 999999999999.dkr.ecr.ap-northeast-2.amazonaws.com/jane-shop-apis:latest
리포지토리에 푸시한다.
% docker push 999999999999.dkr.ecr.ap-northeast-2.amazonaws.com/jane-shop-apis:latest
The push refers to repository [999999999999.dkr.ecr.ap-northeast-2.amazonaws.com/jane-shop-apis]
2b993c466313: Pushed
ce4d9dca42ab: Pushed
bf6966a26069: Pushed
603c07dac9f8: Pushed
edd61588d126: Pushed
9b9b7f3d56a0: Pushed
f1b5933fe4b5: Pushed
latest: digest: sha256:b769696a78c4dbdc1da723aac5672ae5cc78f6456d88d4dd0e39cb054ff70bd0 size: 1788
작업이 완료된 후에 리포지토리에 가보면 이렇게 올라간 것을 확인할 수 있다.
[AWS] ECS 올리기 - 1. VPC (https://a-half-human-half-developer.tistory.com/158)
[AWS] ECS 올리기 - 2. ECR (https://a-half-human-half-developer.tistory.com/159)
[AWS] ECS 올리기 - 3. ALB & Target Group (https://a-half-human-half-developer.tistory.com/160)
[AWS] ECS 올리기 - 4. ECS (https://a-half-human-half-developer.tistory.com/161)
[AWS] ECS 올리기 - 5. 도메인 연결 및 SSL 인증서 적용 (https://a-half-human-half-developer.tistory.com/162)
'AWS' 카테고리의 다른 글
[AWS] ECS 올리기 - 4. ECS (0) | 2022.03.29 |
---|---|
[AWS] ECS 올리기 - 3. ALB & Target Group (1) | 2022.03.25 |
[AWS] ECS 올리기 - 1. VPC (0) | 2022.03.25 |
[AWS] CodeCommit 소스 다운로드 (0) | 2021.02.16 |
[AWS] LDAP (0) | 2021.02.10 |