Skip to content
Draft
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.2
10 changes: 7 additions & 3 deletions Dockerfile.lambda
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM public.ecr.aws/lambda/nodejs:12
FROM public.ecr.aws/lambda/nodejs:18-x86_64

ENV DOCKERIZED yes
ENV PUPPETEER_CACHE_DIR /puppeteer-cache

RUN yum install -y \
git gcc make gcc-c++ zlib-devel libjpeg-turbo-devel nasm automake autoconf libtool \
Expand All @@ -27,8 +28,11 @@ RUN yum install -y \

ADD . /var/task

RUN rm -rf node_modules && \

RUN mkdir -p /puppeteer-cache && rm -rf node_modules && \
npm install jpegoptim-bin --unsafe-perm=true --allow-root && \
NODE_ENV=development && npm install --only=prod
NODE_ENV=production && npm install --only=prod && \
sed -i '35 s/^/\/\//' node_modules/phantomas/lib/browser.js && \
rm -f node_modules/phantomas/modules/analyzeCss/analyzeCss.js

CMD [ "lambda.runner" ]
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@ DOCKER_IMAGE_TAG ?= latest
RESULT_BUCKET_NAME ?= $(env)-yellowlabtools-storage
TEST_NAME ?= test-local
TEST_URL ?= https://www.google.fr
RUNNER_SUFFIX ?=

all: install

install:
@npm install

build-docker-image-lambda:
@docker build -f Dockerfile.lambda -t yellowlabtools-runner-lambda .
@docker build -f Dockerfile.lambda -t yellowlabtools-runner$(RUNNER_SUFFIX)-lambda .

tag-docker-image-lambda:
@docker tag yellowlabtools-runner-lambda:$(DOCKER_IMAGE_TAG) $(DOCKER_REGISTRY)/yellowlabtools-runner-lambda:$(DOCKER_IMAGE_TAG)
@docker tag yellowlabtools-runner$(RUNNER_SUFFIX)-lambda:$(DOCKER_IMAGE_TAG) $(DOCKER_REGISTRY)/yellowlabtools-runner$(RUNNER_SUFFIX)-lambda:$(DOCKER_IMAGE_TAG)

push-docker-image-lambda:
@docker push $(DOCKER_REGISTRY)/yellowlabtools-runner-lambda:$(DOCKER_IMAGE_TAG)
@docker push $(DOCKER_REGISTRY)/yellowlabtools-runner$(RUNNER_SUFFIX)-lambda:$(DOCKER_IMAGE_TAG)

login-docker:
@AWS_PROFILE=$(AWS_PROFILE) aws ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin $(DOCKER_REGISTRY)

start-local-lambda:
@docker run --rm -it -p 9000:8080 -e RESULT_BUCKET_NAME=$(RESULT_BUCKET_NAME) -e AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) -e AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) yellowlabtools-runner-lambda:$(DOCKER_IMAGE_TAG)
@docker run --rm -it -p 9000:8080 -e RESULT_BUCKET_NAME=$(RESULT_BUCKET_NAME) -e AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) -e AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) yellowlabtools-runner$(RUNNER_SUFFIX)-lambda:$(DOCKER_IMAGE_TAG)

run-local-test:
@curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"id": "$(TEST_NAME)", "url": "$(TEST_URL)"}'
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yellowlabtools-lambda-agent",
"version": "1.0.0",
"version": "3.0.0",
"description": "The AWS Lambda testing agent that's in use on https://yellowlab.tools",
"main": "lambda.js",
"scripts": {
Expand All @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/YellowLabTools/YellowLabTools-lambda-agent#readme",
"dependencies": {
"aws-sdk": "2.904.0",
"yellowlabtools": "2.1.0"
"aws-sdk": "^2.1488.0",
"yellowlabtools": "3.0.1"
}
}