@@ -79,7 +79,7 @@ You can build RIE into a base image. Download the RIE from GitHub to your local
79
79
80
80
The following example shows a typical script for a Node.js function.
81
81
82
- ```
82
+ ``` sh
83
83
#! /bin/sh
84
84
if [ -z " ${AWS_LAMBDA_RUNTIME_API} " ]; then
85
85
exec /usr/local/bin/aws-lambda-rie /usr/bin/npx aws-lambda-ric
@@ -93,28 +93,24 @@ You can build RIE into a base image. Download the RIE from GitHub to your local
93
93
3. Install the emulator package and change ` ENTRYPOINT` to run the new script by adding the following lines to your Dockerfile:
94
94
95
95
To use the default x86\_ 64 architecture
96
-
97
- ```
96
+ ` ` ` dockerfile
98
97
ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
99
98
ENTRYPOINT [ " /entry_script.sh" ]
100
99
` ` `
101
100
102
101
To use the arm64 architecture:
103
-
104
- ```
102
+ ` ` ` dockerfile
105
103
ADD aws-lambda-rie-arm64 /usr/local/bin/aws-lambda-rie
106
104
ENTRYPOINT [ " /entry_script.sh" ]
107
105
` ` `
108
106
109
107
4. Build your image locally using the docker build command.
110
-
111
- ```
108
+ ` ` ` sh
112
109
docker build -t myfunction:latest .
113
110
` ` `
114
111
115
112
5. Run your image locally using the docker run command.
116
-
117
- ```
113
+ ` ` ` sh
118
114
docker run -p 9000:8080 myfunction:latest
119
115
` ` `
120
116
@@ -125,7 +121,7 @@ You install the runtime interface emulator to your local machine. When you run t
125
121
126
122
1. From your project directory, run the following command to download the RIE (x86-64 architecture) from GitHub and install it on your local machine.
127
123
128
- ```
124
+ ` ` ` sh
129
125
mkdir -p ~ /.aws-lambda-rie && curl -Lo ~ /.aws-lambda-rie/aws-lambda-rie \
130
126
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
131
127
&& chmod +x ~ /.aws-lambda-rie/aws-lambda-rie
@@ -138,17 +134,18 @@ You install the runtime interface emulator to your local machine. When you run t
138
134
```
139
135
140
136
2. Run your Lambda image function using the docker run command.
141
-
142
- ```
143
- docker run -d -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest
144
- --entrypoint /aws-lambda/aws-lambda-rie <image entrypoint> <(optional) image command>`
137
+ ` ` ` sh
138
+ docker run -d -v ~ /.aws-lambda-rie:/aws-lambda -p 9000:8080 myfunction:latest \
139
+ --entrypoint /aws-lambda/aws-lambda-rie < image entrypoint> <( optional) image command>
145
140
` ` `
146
141
147
142
This runs the image as a container and starts up an endpoint locally at ` localhost:9000/2015-03-31/functions/function/invocations` .
148
143
149
144
3. Post an event to the following endpoint using a curl command:
150
145
151
- `curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'`
146
+ ` ` ` sh
147
+ curl -XPOST " http://localhost:9000/2015-03-31/functions/function/invocations" -d ' {}'
148
+ ` ` `
152
149
153
150
This command invokes the function running in the container image and returns a response.
154
151
0 commit comments