AWS-CDK 이미지 컨테이너 생성
모든 CDK 개발자는 Node.js 10.3.0 이상을 설치해야 합니다. Python과 같은 TypeScript 또는 JavaScript 이외의 언어로 작업하는 경우에도 마찬가지입니다.
중요: Node.js 버전 13.0.0~13.6.0은 AWS CDK와 호환되지 않습니다.
amazon/aws-lambda-python(또는 Python 기본 이미지)에서 AWS-CDK 이미지 컨테이너를 생성하고 nodejs 12를 설치하는 방법
이 문서의 내용
🚀 도커파일
amazon/aws-lambda-python:3.8
FROM amazon/aws-lambda-python:3.8
ENV AWS_CDK_VERSION=1.73.0
ENV AWS_DEFAULT_REGION=ap-northeast-2
WORKDIR /opt/stack
RUN yum -y update && \
curl -sL https://rpm.nodesource.com/setup_12.x | bash - && \
yum list available nodejs && \
yum install -y python3-pip && \
yum install -y nodejs && \
npm install -g aws-cdk@${AWS_CDK_VERSION} && \
pip3 install aws-cdk.aws-ec2 aws-cdk.aws-route53 aws-cdk.aws-iam aws-cdk.aws-elasticloadbalancingv2 aws-cdk.core
CMD ["cdk version"]
🚀 컨테이너 이미지 빌드 및 테스트
⚡ $ docker build -t awscdk .
⚡ $ docker run -d --name test -it awscdk
30d272c6ad8abaa4162fdc090d81d0641d287f4ae161606bcc365da6ffe2284e
⚡ $ docker exec test cdk version
1.73.0 (build eb6f3a9)
⚡ $ docker exec test node --version
v12.20.0
⚡ $ docker exec test npm --version
6.14.8
⚡ $ docker exec test cdk init -l python
Applying project template app for python
# Welcome to your CDK Python project!
This is a blank project for Python development with CDK.
The `cdk.json` file tells the CDK Toolkit how to execute your app.
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the `.venv`
directory. To create the virtualenv it assumes that there is a `python3`
(or `python` for Windows) executable in your path with access to the `venv`
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.
To manually create a virtualenv on MacOS and Linux:
Enjoy!
Initializing a new git repository...
/bin/sh: git: command not found
Unable to initialize git repository for your project.
Please run 'python3 -m venv .venv'!
Executing Creating virtualenv...
✅ All done!
⚡ $ docker exec -it test ls
app.py cdk.json README.md requirements.txt setup.py source.bat stack
⚡ $ docker exec -it test ls stack
__init__.py stack_stack.py
거울:
더 읽어보기
· 편물 · · · 페이지 ·
Reference
이 문제에 관하여(AWS-CDK 이미지 컨테이너 생성), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/vumdao/create-aws-cdk-image-container-43ei텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)