From 5ac593374deaba98ddfdc183e79230967da056e4 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Tue, 30 Nov 2021 13:24:36 +0200 Subject: [PATCH 1/4] humanmade/terraform-app-stack#965 update nodejs to v 14.x --- Dockerfile | 2 +- hooks/pre_build | 2 +- local-api-gateway.js | 2 +- package-lock.json | 2 +- package.json | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 681182d..55959fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lambci/lambda:nodejs10.x +FROM public.ecr.aws/lambda/nodejs:14 COPY node_modules/ /var/task/node_modules COPY server.js /var/task/ COPY index.js /var/task diff --git a/hooks/pre_build b/hooks/pre_build index 3e62e16..184e17d 100755 --- a/hooks/pre_build +++ b/hooks/pre_build @@ -1,3 +1,3 @@ #!/bin/bash # Build node_modules -docker run --rm -v `pwd`:/var/task lambci/lambda:build-nodejs10.x npm install +docker run --rm -v `pwd`:/var/task public.ecr.aws/sam/build-nodejs14.x:latest npm install diff --git a/local-api-gateway.js b/local-api-gateway.js index 8538442..859b256 100644 --- a/local-api-gateway.js +++ b/local-api-gateway.js @@ -18,7 +18,7 @@ http.createServer(function (request, response) { queryStringParameters: querystring.parse( query ), headers: request.headers, }; - const childArgs = ['run', '--rm', '-e', `S3_BUCKET=${ bucket }`, '-e', `S3_REGION=${ region }`, '-v', `${ task }:/var/task`, 'lambci/lambda:nodejs10.x', 'lambda-handler.handler', JSON.stringify(args)]; + const childArgs = ['run', '--rm', '-e', `S3_BUCKET=${ bucket }`, '-e', `S3_REGION=${ region }`, '-v', `${ task }:/var/task`, 'public.ecr.aws/lambda/nodejs:14', 'lambda-handler.handler', JSON.stringify(args)]; const child = spawn('docker', childArgs); var stdout = ''; child.stdout.on('data', data => stdout += data); diff --git a/package-lock.json b/package-lock.json index aa37646..a1d9090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "node-tachyon", - "version": "2.2.1", + "version": "2.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 752d1e1..72dd8ec 100755 --- a/package.json +++ b/package.json @@ -14,10 +14,10 @@ "function-name": "" }, "scripts": { - "build-node-modules": "rm -R node_modules ; docker run --rm -v `pwd`:/var/task lambci/lambda:build-nodejs10.x npm install", - "test-file": "docker run --rm -e S3_BUCKET=hmn-uploads-eu -e S3_REGION=eu-west-1 -v `pwd`:/var/task lambci/lambda:nodejs10.x lambda-handler.handler '{\"path\":\"/'$npm_config_path'\", \"headers\":{}}'", - "test": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' lambci/lambda:nodejs10.x /var/task/test-filesize/index.js", - "update-test-fixtures": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' lambci/lambda:nodejs10.x /var/task/test-filesize/index.js --update-fixtures", + "build-node-modules": "rm -R node_modules ; docker run --rm -v `pwd`:/var/task public.ecr.aws/sam/build-nodejs14.x:latest npm install", + "test-file": "docker run --rm -e S3_BUCKET=hmn-uploads-eu -e S3_REGION=eu-west-1 -v `pwd`:/var/task public.ecr.aws/lambda/nodejs:14 lambda-handler.handler '{\"path\":\"/'$npm_config_path'\", \"headers\":{}}'", + "test": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' public.ecr.aws/lambda/nodejs:14 /var/task/test-filesize/index.js", + "update-test-fixtures": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' public.ecr.aws/lambda/nodejs:14 /var/task/test-filesize/index.js --update-fixtures", "build-zip": "rm lambda.zip; zip -r --exclude='node_modules/aws-sdk/*' --exclude='node_modules/animated-gif-detector/test/*' lambda.zip ./node_modules/ index.js proxy-file.js lambda-handler.js", "upload-zip": "aws s3 --region=$npm_config_region cp ./lambda.zip s3://$npm_config_bucket/$npm_config_path", "update-function-code": "aws lambda update-function-code --region $npm_config_region --function-name $npm_config_function_name --zip-file fileb://`pwd`/lambda.zip" From 8105bf718d6648848d02c592185089b12ac0ee8c Mon Sep 17 00:00:00 2001 From: Stanislav Date: Thu, 2 Dec 2021 15:08:31 +0200 Subject: [PATCH 2/4] humanmade/terraform-app-stack#965 added quotes to overriden entrypoint to treat it as a single parameter instead of 2 separate --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 72dd8ec..0501549 100755 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "scripts": { "build-node-modules": "rm -R node_modules ; docker run --rm -v `pwd`:/var/task public.ecr.aws/sam/build-nodejs14.x:latest npm install", - "test-file": "docker run --rm -e S3_BUCKET=hmn-uploads-eu -e S3_REGION=eu-west-1 -v `pwd`:/var/task public.ecr.aws/lambda/nodejs:14 lambda-handler.handler '{\"path\":\"/'$npm_config_path'\", \"headers\":{}}'", + "test-file": "docker run --rm -e S3_BUCKET=hmn-uploads-eu -e S3_REGION=eu-west-1 -v `pwd`:/var/task public.ecr.aws/lambda/nodejs:14 \"lambda-handler.handler '{\"path\":\"/'$npm_config_path'\", \"headers\":{}}'\"", "test": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' public.ecr.aws/lambda/nodejs:14 /var/task/test-filesize/index.js", "update-test-fixtures": "docker run --rm -v `pwd`:/var/task -it --entrypoint='node' public.ecr.aws/lambda/nodejs:14 /var/task/test-filesize/index.js --update-fixtures", "build-zip": "rm lambda.zip; zip -r --exclude='node_modules/aws-sdk/*' --exclude='node_modules/animated-gif-detector/test/*' lambda.zip ./node_modules/ index.js proxy-file.js lambda-handler.js", From 5d4ec779ebed319dd265284019576ebaefd9743b Mon Sep 17 00:00:00 2001 From: Robert O'Rourke Date: Thu, 2 Dec 2021 17:09:31 +0000 Subject: [PATCH 3/4] Remove unused hooks, add docker auth on travis --- .travis.yml | 3 +++ hooks/pre_build | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100755 hooks/pre_build diff --git a/.travis.yml b/.travis.yml index 6747121..bb87434 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ services: notifications: email: false +before_install: + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + before_script: - npm run build-node-modules diff --git a/hooks/pre_build b/hooks/pre_build deleted file mode 100755 index 184e17d..0000000 --- a/hooks/pre_build +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# Build node_modules -docker run --rm -v `pwd`:/var/task public.ecr.aws/sam/build-nodejs14.x:latest npm install From 49acbdc23189050ca69ae3952e637c42f25ba494 Mon Sep 17 00:00:00 2001 From: Robert O'Rourke Date: Fri, 3 Dec 2021 10:41:19 +0000 Subject: [PATCH 4/4] Fix docker build --- Dockerfile.multiarch | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile.multiarch b/Dockerfile.multiarch index 3baa998..d071c49 100644 --- a/Dockerfile.multiarch +++ b/Dockerfile.multiarch @@ -2,10 +2,8 @@ FROM node:14-alpine # Install build base RUN apk --update add --no-cache \ - # --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \ - --virtual build-deps fftw-dev gcc g++ make libc6-compat python + --virtual build-deps fftw-dev gcc g++ make libc6-compat python3 RUN apk --update add --no-cache \ - # --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \ vips-dev # Get app