-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changing from aws-chromelambda to @sparticuz/chromium (#492)
* change the lib from chrome-aws-lambda to @sparticuz/chromium * update example dependency * create a setup to run the lambda locally * update the docs * yarn.lock * add the docker lambda prepared on github action * empty line in the end * change the command to pretest * updating the chrome-laucher version * add the workspace and using nohoist for the example * verbose log for chrome-laucher when debug is enabled and fix timeout test
- Loading branch information
1 parent
aac057d
commit bbeb64a
Showing
16 changed files
with
339 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM amazon/aws-lambda-nodejs:18 | ||
|
||
ENV DEBUG=* | ||
|
||
ADD fixtures ${LAMBDA_TASK_ROOT}/fixtures | ||
|
||
COPY package.json ${LAMBDA_TASK_ROOT} | ||
|
||
COPY docker_node_modules ${LAMBDA_TASK_ROOT}/node_modules | ||
|
||
COPY index.js ${LAMBDA_TASK_ROOT} | ||
|
||
CMD ["index.handler"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### Running the lambda locally | ||
This is to simulate and run the lambda locally for development and test pourpose. | ||
|
||
### Commands | ||
```sh | ||
yarn build | ||
``` | ||
|
||
This command will build the docker image with the lambda. | ||
|
||
```sh | ||
yarn start | ||
``` | ||
|
||
This command will start the docker. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
CONTAINER_ID=$(docker ps -a | grep "example-renderer-aws-lambda" | awk '{print $1}') | ||
|
||
if [ ! -z "$CONTAINER_ID" ]; | ||
then | ||
echo "Stopping and removing container..." | ||
docker stop $CONTAINER_ID 2>&1 | ||
docker rm $CONTAINER_ID 2>&1 | ||
fi | ||
|
||
IMAGE_NAME=$(docker images | grep "example-renderer-aws-lambda" | awk '{print $1}') | ||
|
||
if [ ! -z "$IMAGE_NAME" ]; | ||
then | ||
echo "Removing image..." | ||
docker rmi $IMAGE_NAME 2>&1 | ||
fi | ||
|
||
rm -rf node_modules | ||
|
||
yarn | ||
|
||
cp -R ../../fixtures fixtures | ||
|
||
# it is needed to resolve the symlinks that are create by nohoist | ||
cp -RL node_modules docker_node_modules | ||
|
||
docker build . -t example-renderer-aws-lambda:latest | ||
|
||
rm -rf fixtures | ||
rm -rf docker_node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const { createChromeAWSLambdaRenderer } = require('@loki/renderer-aws-lambda'); | ||
|
||
module.exports = { | ||
handler: createChromeAWSLambdaRenderer(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@loki/example-running-renderer-aws-lambda", | ||
"version": "0.33.1", | ||
"private": true, | ||
"scripts": { | ||
"build": "sh build.sh", | ||
"start": "docker run -d -p 8080:8080 -t example-renderer-aws-lambda:latest" | ||
}, | ||
"workspaces": { | ||
"nohoist": ["**"] | ||
}, | ||
"dependencies": { | ||
"@loki/renderer-aws-lambda": "0.33.1", | ||
"@sparticuz/chromium": "118.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+338 Bytes
(110%)
packages/renderer-aws-lambda/__snapshots__/example-button-large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.