From 66dcdfcbf66302aaad1c3135934832488a938848 Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Tue, 9 Feb 2021 21:12:49 -0800 Subject: [PATCH 1/3] Update README to reflect current local testing and building considerations. --- README.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdca04a..dc10c02 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,20 @@ executables: # ... ``` +You'll need to either build on a compatible linux host or inside a compatible docker container (or some other mechanism like nix). +Note that current Stack LTS images are _not_ compatible. +If you see an error message that contains "version `GLIBC_X.XX' not found" when running (hosted or locally), then your build environment is not compatible. + +Enable stack's docker integration and define an optional image within stack.yaml: + +```yaml +# file: stack.yaml +docker: + enabled: true + # If omitted, this defaults to fpco/stack-build:lts-${YOUR_LTS_VERSIO} + image: ${BUILD_IMAGE} +``` + Don't forget to define your [CloudFormation] stack: ```yaml @@ -164,7 +178,6 @@ aws lambda invoke \ - [Stack][stack.yaml] - [Docker] - - [aws-sam-cli] (>v0.8.0) ### Build @@ -173,7 +186,19 @@ docker pull fpco/stack-build:lts-{version} # First build only, find the latest v stack build --copy-bins ``` -### Execute +### Execute w/ Docker + +```bash +echo '{ "accountId": "byebye" }' | docker run -i --rm \ + -e DOCKER_LAMBDA_USE_STDIN=1 \ + # TODO: check that this pathing works + -v .stack-work/docker/_home/.local/bin/:/var/task \ + lambci/lambda:provided +``` + +### Execute w/ SAM Local + +Note that [aws-sam-cli] is currently only supported until <1.0. ```bash echo '{ "accountId": "byebye" }' | sam local invoke --region us-east-1 From adc6d72e74f4c79a06c07db86b73fc85990f03d0 Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Tue, 9 Feb 2021 21:25:28 -0800 Subject: [PATCH 2/3] Update local execution docker volume path to correct working example. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index dc10c02..184a918 100644 --- a/README.md +++ b/README.md @@ -191,8 +191,7 @@ stack build --copy-bins ```bash echo '{ "accountId": "byebye" }' | docker run -i --rm \ -e DOCKER_LAMBDA_USE_STDIN=1 \ - # TODO: check that this pathing works - -v .stack-work/docker/_home/.local/bin/:/var/task \ + -v ${PWD}/.stack-work/docker/_home/.local/bin/:/var/task \ lambci/lambda:provided ``` From a4c5ff5fa7b819225de4801e0e068cee46a7f707 Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Sun, 14 Feb 2021 21:30:07 -0800 Subject: [PATCH 3/3] Minor fixes. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 184a918..254e91d 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ executables: You'll need to either build on a compatible linux host or inside a compatible docker container (or some other mechanism like nix). Note that current Stack LTS images are _not_ compatible. -If you see an error message that contains "version `GLIBC_X.XX' not found" when running (hosted or locally), then your build environment is not compatible. +If you see an error message that contains "version 'GLIBC_X.XX' not found" when running (hosted or locally), then your build environment is not compatible. Enable stack's docker integration and define an optional image within stack.yaml: @@ -120,7 +120,7 @@ Enable stack's docker integration and define an optional image within stack.yaml # file: stack.yaml docker: enabled: true - # If omitted, this defaults to fpco/stack-build:lts-${YOUR_LTS_VERSIO} + # If omitted, this defaults to fpco/stack-build:lts-${YOUR_LTS_VERSION} image: ${BUILD_IMAGE} ``` @@ -197,7 +197,7 @@ echo '{ "accountId": "byebye" }' | docker run -i --rm \ ### Execute w/ SAM Local -Note that [aws-sam-cli] is currently only supported until <1.0. +Note that hal currently only supports [aws-sam-cli] on versions <1.0. ```bash echo '{ "accountId": "byebye" }' | sam local invoke --region us-east-1