Skip to content

Commit 0397305

Browse files
committed
upgrade to emulation of amazon provided.al2 runtime
1 parent 4e8e978 commit 0397305

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ $ docker run --rm \
1414

1515
* Upgrade to Rust [`1.45.2`](https://blog.rust-lang.org/2020/08/03/Rust-1.45.2.html)
1616

17+
* Upgrade to [amazon linux 2](https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-to-al2/) base
18+
1719
# 0.3.0-rust-1.45.0
1820

1921
* Upgrade to Rust [`1.45.0`](https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html)

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# https://github.com/lambci/docker-lambda#documentation
2-
FROM lambci/lambda:build-provided
2+
FROM lambci/lambda:build-provided.al2
3+
34
ARG RUST_VERSION=1.45.2
45
RUN yum install -y jq
56
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.3.0
1+
VERSION ?= 0.4.0
22
RUST_VERSION ?= 1.45.2
33
REPO ?= softprops/lambda-rust
44
TAG ?= "$(REPO):$(VERSION)-rust-$(RUST_VERSION)"

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## 🤔 about
55

6-
This docker image extends [lambda ci `provided`](https://github.com/lambci/docker-lambda#documentation) builder docker image, a faithful reproduction of the actual AWS "**provided**" Lambda runtime environment,
6+
This docker image extends [lambda ci `provided.al2`](https://github.com/lambci/docker-lambda#documentation) builder docker image, a faithful reproduction of the actual AWS "**provided.al2**" Lambda runtime environment,
77
and installs [rustup](https://rustup.rs/) and the *stable* rust toolchain.
88

99
This provides a build environment, consistent with your target execution environment for predictable results.
@@ -99,7 +99,7 @@ You can take a look at an example [here](./tests/test-func-with-hooks).
9999

100100
## 🔬 local testing
101101

102-
Once you've built a Rust lambda function artifact, the `provided` runtime expects
102+
Once you've built a Rust lambda function artifact, the `provided.al2` runtime expects
103103
deployments of that artifact to be named "**bootstrap**". The `lambda-rust` docker image
104104
builds a zip file, named after the binary, containing your binary file renamed to "bootstrap" for you, but zip file creation is unnecessary for local development.
105105

@@ -108,7 +108,7 @@ output (not zipped) is available under `target/lambda/{profile}/output/{your-lam
108108
You will see both `bootstrap` and `bootstrap.debug` files there.
109109
> **⚠️ Note:** `PACKAGE=false` prevents `package` hook from running.
110110
111-
You can then invoke this bootstap executable with the lambda-ci docker image for the `provided` AWS lambda runtime with a one off container.
111+
You can then invoke this bootstap executable with the lambda-ci docker image for the `provided.al2` AWS lambda runtime with a one off container.
112112

113113
```sh
114114
# Build your function skipping the zip creation step
@@ -122,13 +122,13 @@ docker run \
122122
-v ${HOME}/.cargo/git:/cargo/git \
123123
softprops/lambda-rust
124124

125-
# start a one-off docker container replicating the "provided" lambda runtime
125+
# start a one-off docker container replicating the "provided.al2" lambda runtime
126126
# awaiting an event to be provided via stdin
127127
$ docker run \
128128
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
129129
--rm \
130130
-v ${PWD}/target/lambda/release/output/{your-binary-name}:/var/task:ro,delegated \
131-
lambci/lambda:provided
131+
lambci/lambda:provided.al2
132132

133133
# provide an event payload via stdin (typically a json blob)
134134

@@ -148,7 +148,7 @@ $ unzip -o \
148148
-v /tmp/lambda:/var/task:ro,delegated \
149149
-e DOCKER_LAMBDA_STAY_OPEN=1 \
150150
-p 9001:9001 \
151-
lambci/lambda:provided
151+
lambci/lambda:provided.al2
152152
```
153153

154154
In a separate terminal, you can invoke your function with `curl`

tests/test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ for project in test-func test-multi-func test-func-with-hooks; do
8686

8787
assert "it packages all bins" package_all "${bin_name}"
8888

89-
# verify packaged artifact by invoking it using the lambdaci "provided" docker image
89+
# verify packaged artifact by invoking it using the lambdaci "provided.al2" docker image
9090
rm -f output.log > /dev/null 2>&1
9191
rm -f test-out.log > /dev/null 2>&1
9292
rm -rf /tmp/lambda > /dev/null 2>&1
@@ -97,7 +97,7 @@ for project in test-func test-multi-func test-func-with-hooks; do
9797
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
9898
--rm \
9999
-v /tmp/lambda:/var/task \
100-
lambci/lambda:provided < test-event.json | grep -v RequestId | grep -v '^\W*$' > test-out.log
100+
lambci/lambda:provided.al2 < test-event.json | grep -v RequestId | grep -v '^\W*$' > test-out.log
101101

102102
assert "when invoked, it produces expected output" diff expected-output.json test-out.log
103103
done

0 commit comments

Comments
 (0)