Skip to content

Add Dockerfile build Lambda environment for test #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .aws/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[default]
region = us-east-1


3 changes: 3 additions & 0 deletions .aws/credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default]
aws_access_key_id = <your aws_access_key_id>
aws_secret_access_key = <your aws_secret_access_key>
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ module.exports = {
"extends": "google",
"parserOptions": {
"ecmaVersion": 2017,
},
"rules":{
"linebreak-style": [0 ,"error", "windows"]
}
};
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM amazonlinux:2017.03.1.20170812
RUN yum install -y aws-cli
RUN yum groupinstall -y 'Development Tools'
RUN curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
RUN yum -y install nodejs-6.10.3
ADD ./.aws /root/.aws
RUN npm install serverless -g
WORKDIR /start-kit
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ If you want to use latest chrome, run chrome/buildChrome.sh on EC2 having at lea
See also [serverless-chrome](https://github.com/adieuadieu/serverless-chrome/blob/master/docs/chrome.md).
Once you build it, link to `headless_shell.tar.gz` in `chrome` dir.

## Build Lambda environment by docker (optional)

Amazon provider docker image in dokcer store ,it can build Lambda environment for test
[https://store.docker.com/images/amazonlinux]

1. install docker & docker-compose
- docker [https://docs.docker.com/install/]
- docker-compose [https://docs.docker.com/compose/install/#master-builds]
2. setup aws credentials in `.aws` folder
3. `docker-compose up --build`
4. `docker-compose exec lambda-env bash`
5. `cd /start-kit`
6. `npm install `
7. start to test

## Article

[Lambda上でPuppeteer/Headless Chromeを動かすStarter Kitを作った - sambaiz-net](https://www.sambaiz.net/article/132/)
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"
services:
lambda-env:
build: .
image: startkit/aws-lambda-env-2018:latest
command: node
volumes:
- ./:/start-kit
stdin_open: true
tty: true