forked from lambci/docker-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nodejs8.10 runtime, add isFatal handling
Add AWS_EXECUTION_ENV for Go runtime Update .NET build to SDK 2.1.4 Clean up JS style
- Loading branch information
Showing
35 changed files
with
512 additions
and
173 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
var fs = require('fs') | ||
var childProcess = require('child_process') | ||
var AWS = require('aws-sdk') | ||
var s3 = new AWS.S3() | ||
|
||
exports.handler = function(event, context, cb) { | ||
var filename = 'nodejs8.10.tgz' | ||
var cmd = 'tar -cpzf /tmp/' + filename + | ||
' --numeric-owner --ignore-failed-read /var/runtime /var/lang' | ||
|
||
var child = childProcess.spawn('sh', ['-c', event.cmd || cmd]) | ||
child.stdout.setEncoding('utf8') | ||
child.stderr.setEncoding('utf8') | ||
child.stdout.on('data', console.log.bind(console)) | ||
child.stderr.on('data', console.error.bind(console)) | ||
child.on('error', cb) | ||
|
||
child.on('close', function() { | ||
if (event.cmd) return cb() | ||
|
||
console.log('Zipping done! Uploading...') | ||
|
||
s3.upload({ | ||
Bucket: 'lambci', | ||
Key: 'fs/' + filename, | ||
Body: fs.createReadStream('/tmp/' + filename), | ||
ACL: 'public-read', | ||
}, function(err, data) { | ||
if (err) return cb(err) | ||
|
||
console.log('Uploading done!') | ||
|
||
console.log(process.execPath) | ||
console.log(process.execArgv) | ||
console.log(process.argv) | ||
console.log(process.cwd()) | ||
console.log(__filename) | ||
console.log(process.env) | ||
console.log(context) | ||
|
||
cb(null, data) | ||
}) | ||
}) | ||
} | ||
|
||
// /var/lang/bin/node | ||
// [ '--max-old-space-size=1229', '--max-semi-space-size=76', '--max-executable-size=153', '--expose-gc' ] | ||
// [ '/var/lang/bin/node', '/var/runtime/node_modules/awslambda/index.js' ] | ||
// /var/task | ||
// /var/task/index.js | ||
// { | ||
// PATH: '/var/lang/bin:/usr/local/bin:/usr/bin/:/bin', | ||
// LANG: 'en_US.UTF-8', | ||
// LD_LIBRARY_PATH: '/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib', | ||
// LAMBDA_TASK_ROOT: '/var/task', | ||
// LAMBDA_RUNTIME_DIR: '/var/runtime', | ||
// AWS_REGION: 'us-east-1', | ||
// AWS_DEFAULT_REGION: 'us-east-1', | ||
// AWS_LAMBDA_LOG_GROUP_NAME: '/aws/lambda/dump-node810', | ||
// AWS_LAMBDA_LOG_STREAM_NAME: '2017/03/23/[$LATEST]c079a84d433534434534ef0ddc99d00f', | ||
// AWS_LAMBDA_FUNCTION_NAME: 'dump-node810', | ||
// AWS_LAMBDA_FUNCTION_MEMORY_SIZE: '1536', | ||
// AWS_LAMBDA_FUNCTION_VERSION: '$LATEST', | ||
// _AWS_XRAY_DAEMON_ADDRESS: '169.254.79.2', | ||
// _AWS_XRAY_DAEMON_PORT: '2000', | ||
// AWS_XRAY_DAEMON_ADDRESS: '169.254.79.2:2000', | ||
// AWS_XRAY_CONTEXT_MISSING: 'LOG_ERROR', | ||
// _X_AMZN_TRACE_ID: 'Root=1-dc99d00f-c079a84d433534434534ef0d;Parent=91ed514f1e5c03b2;Sampled=0', | ||
// AWS_EXECUTION_ENV: 'AWS_Lambda_nodejs8.10', | ||
// NODE_PATH: '/var/runtime:/var/task:/var/runtime/node_modules', | ||
// AWS_ACCESS_KEY_ID: 'ASIA...C37A', | ||
// AWS_SECRET_ACCESS_KEY: 'JZvD...BDZ4L', | ||
// AWS_SESSION_TOKEN: 'FQoDYXdzEMb//////////...0oog7bzuQU=' | ||
// } | ||
// { | ||
// callbackWaitsForEmptyEventLoop: [Getter/Setter], | ||
// done: [Function: done], | ||
// succeed: [Function: succeed], | ||
// fail: [Function: fail], | ||
// logGroupName: '/aws/lambda/dump-node810', | ||
// logStreamName: '2017/03/23/[$LATEST]c079a84d433534434534ef0ddc99d00f', | ||
// functionName: 'dump-node810', | ||
// memoryLimitInMB: '1536', | ||
// functionVersion: '$LATEST', | ||
// getRemainingTimeInMillis: [Function: getRemainingTimeInMillis], | ||
// invokeid: '1fcdc383-a9e8-4228-bc1c-8db17629e183', | ||
// awsRequestId: '1fcdc383-a9e8-4228-bc1c-8db17629e183', | ||
// invokedFunctionArn: 'arn:aws:lambda:us-east-1:879423879432:function:dump-node810' | ||
// } |
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,17 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2017 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockBootstraps", "MockBootstraps.csproj", "{8AD9356B-231B-4B42-B168-D06497B769AF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{8AD9356B-231B-4B42-B168-D06497B769AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{8AD9356B-231B-4B42-B168-D06497B769AF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{8AD9356B-231B-4B42-B168-D06497B769AF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{8AD9356B-231B-4B42-B168-D06497B769AF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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
Binary file not shown.
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
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,26 @@ | ||
// Just a test lambda, run with: | ||
// docker run --rm -v "$PWD":/var/task lambci/lambda:nodejs8.10 | ||
|
||
exports.handler = async(event, context) => { | ||
console.log(process.execPath) | ||
console.log(process.execArgv) | ||
console.log(process.argv) | ||
console.log(process.cwd()) | ||
console.log(process.mainModule.filename) | ||
console.log(__filename) | ||
console.log(process.env) | ||
console.log(process.getuid()) | ||
console.log(process.getgid()) | ||
console.log(process.geteuid()) | ||
console.log(process.getegid()) | ||
console.log(process.getgroups()) | ||
console.log(process.umask()) | ||
|
||
console.log(event) | ||
|
||
console.log(context) | ||
|
||
context.callbackWaitsForEmptyEventLoop = false | ||
|
||
console.log(context.getRemainingTimeInMillis()) | ||
} |
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,8 @@ | ||
{ | ||
"name": "docker-run", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "docker run --rm -v \"$PWD\":/var/task lambci/lambda:nodejs8.10 index.handler '{\"some\": \"event\"}'" | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.