From f997fd2a49141e2647dbba962851b4de99bb04ec Mon Sep 17 00:00:00 2001 From: Jonathan Morley Date: Wed, 23 Jan 2019 18:16:55 -0500 Subject: [PATCH] chore(cdk): add Dockerfile for toolkit container (#1569) Fixes #1302. --- .dockerignore | 2 ++ CONTRIBUTING.md | 25 ++++++++++++++++++++++++- Dockerfile | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000..6e19512a0e024 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.dockerignore +Dockerfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af75f4ac59e14..19c6bce4f8114 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -198,6 +198,29 @@ If you also wish to package to all languages, make sure you have all the [toolch $ ./pack.sh ``` +### Full Docker build + +Clone the repo: + +```console +$ git clone git@github.com/awslabs/aws-cdk +$ cd aws-cdk +``` + +If you already have a local repo and you want a fresh build, run `git clean -fdx` from the root. + +Build the docker image: + +```console +$ docker build -t aws-cdk . +``` + +This allows you to run the CDK in a CDK-compatible directory with a command like: + +```console +$ docker run -v $(pwd):/app -w /app aws-cdk +``` + ### Partial build In many cases, you don't really need to build the entire project. Say you want to work on the `@aws-cdk/aws-ec2` module: @@ -268,7 +291,7 @@ $ BUILD_DOCS_DEV=1 ./build-docs.sh ### Tooling Assists #### Jetbrains (WebStorm/IntelliJ) This project uses lerna and utilizes symlinks inside nested node_modules directories. You may encounter an issue during -indexing where the IDE attempts to index these directories and keeps following links until the process runs out of +indexing where the IDE attempts to index these directories and keeps following links until the process runs out of available memory and crashes. To fix this, you can run ```node ./scripts/jetbrains-remove-node-modules.js``` to exclude these directories. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000..a6492c568287f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:8.15-alpine + +WORKDIR /app + +RUN apk add --update \ + bash \ + git \ + rsync \ + zip \ + python3 \ + python3-dev \ + py3-setuptools \ + && rm -rf /var/cache/apk/* + +COPY . . + +RUN ./build.sh \ + && ./link-all.sh + +ENTRYPOINT ["/app/node_modules/.bin/cdk"]