Skip to content

Commit 09cff27

Browse files
committed
init
yep
1 parent 6385bc0 commit 09cff27

19 files changed

+7709
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
layers/sharp/out/sharp-0.23.0-aws-lambda-linux-x64-node-10.16.3.zip filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# package directories
2+
node_modules
3+
# Serverless directories
4+
.serverless
5+
.DS_Store
6+
.env

deploy.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
stage=${STAGE}
2+
region=${REGION}
3+
bucket=${BUCKET}
4+
5+
sls config credentials \
6+
--provider aws \
7+
--key ${SLS_KEY} \
8+
--secret ${SLS_SECRET} \
9+
--profile ${PROFILE}
10+
11+
echo 'Deploying'
12+
sls deploy -s ${STAGE}

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
services:
3+
sharp:
4+
image: woss/aws-sharp-layer
5+
build:
6+
context: ./layers/sharp
7+
dockerfile: Dockerfile
8+
volumes:
9+
- ./layers/sharp:/app
10+
deploy:
11+
image: woss/aws-sharp-layer-test
12+
build:
13+
context: ./example
14+
dockerfile: Dockerfile
15+
volumes:
16+
- ./example:/app
17+
env_file:
18+
- ./.env

example/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = false
8+
insert_final_newline = false

example/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM amazonlinux as baseBox
2+
WORKDIR /app
3+
4+
RUN yum -y install make gcc*
5+
RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
6+
RUN yum -y install nodejs
7+
8+
9+
####################
10+
## DEPLOYMENT BOX ##
11+
####################
12+
FROM baseBox as deployBox
13+
COPY . .
14+
RUN yarn
15+
16+
RUN ["chmod", "+x", "deploy.sh"]
17+
CMD ./deploy.sh ; sleep 2m

example/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "aws-lambda-layer-sharp",
3+
"version": "1.0.0",
4+
"main": "src/handler.js",
5+
"license": "MIT",
6+
"devDependencies": {
7+
"nodemon": "^1.19.2",
8+
"serverless": "^1.52.0",
9+
"serverless-dotenv-plugin": "^2.1.1",
10+
"serverless-offline": "^6.0.0-alpha.40",
11+
"serverless-webpack": "^5.3.1",
12+
"source-map-support": "^0.5.11",
13+
"webpack": "^4.5.0",
14+
"webpack-cli": "^3.3.7",
15+
"webpack-node-externals": "^1.6.0",
16+
"sharp": "^0.23.0"
17+
},
18+
"scripts": {
19+
"start": "nodemon -w ./src/**/* --exec \"yarn offline\" ",
20+
"offline": "sls offline start"
21+
},
22+
"keywords": [],
23+
"author": "",
24+
"description": "",
25+
"dependencies": {
26+
"axios-debug-log": "^0.6.2",
27+
"axios": "^0.19.0",
28+
"mime-types": "^2.1.24"
29+
}
30+
}

example/sample.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SLS_KEY=
2+
SLS_SECRET=
3+
PROFILE=testSls
4+
STAGE=dev
5+
REGION=eu-east-1
6+
DEBUG=axios
7+
# SLS_DEBUG=*

example/serverless.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
service: aws-lambda-layer-sharp
2+
frameworkVersion: '>=1.34.0 <2.0.0'
3+
publish: false
4+
provider:
5+
name: aws
6+
runtime: nodejs10.x
7+
profile: testSls
8+
region: eu-west-1
9+
apiGateway:
10+
minimumCompressionSize: 1024
11+
binaryMediaTypes:
12+
- '*/*'
13+
functions:
14+
test:
15+
handler: ./example/src/handler.handler
16+
events:
17+
- http:
18+
path: sharp
19+
method: get
20+
layers:
21+
- { Ref: SharpLambdaLayer }
22+
custom:
23+
webpack:
24+
webpackConfig: 'webpack.config.js' # Name of webpack configuration file
25+
# includeModules: true # Node modules configuration for packaging
26+
includeModules:
27+
forceExclude:
28+
- sharp
29+
packager: 'yarn' # Packager that will be used to package your external modules
30+
excludeFiles: src/**/*.test.js # Provide a glob for files to ignore
31+
32+
serverless-offline:
33+
port: 4000
34+
host: 0.0.0.0
35+
dontPrintOutput: true
36+
useSeparateProcesses: true
37+
38+
plugins:
39+
- serverless-dotenv-plugin
40+
- serverless-webpack
41+
- serverless-offline
42+
43+
package:
44+
individually: true

example/source-map-install.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('source-map-support').install();

0 commit comments

Comments
 (0)