diff --git a/_dockerhub-deploy.ts b/_dockerhub-deploy.ts index b78142f..b2f51c3 100644 --- a/_dockerhub-deploy.ts +++ b/_dockerhub-deploy.ts @@ -1,7 +1,7 @@ const DENO_VERSION = '0.23.0'; console.log("Building and pushing", DENO_VERSION); -for (const name of ["alpine", "debian", "ubuntu"]) { +for (const name of ["alpine", "debian", "ubuntu", "amazonlinux-1"]) { const p1 = Deno.run({ args: [ "docker", diff --git a/amazonlinux-1.dockerfile b/amazonlinux-1.dockerfile index 8b1640d..b632eaf 100644 --- a/amazonlinux-1.dockerfile +++ b/amazonlinux-1.dockerfile @@ -39,6 +39,7 @@ RUN curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSIO && rm deno.tar.gz RUN cp /bin/gn /deno/core/libdeno/buildtools/linux64/gn +RUN rm /deno/third_party/prebuilt/linux64/sccache RUN yum install -y gcc-c++ libatomic RUN echo "INPUT ( /usr/lib64/libatomic.so.1.2.0 )" \ diff --git a/aws-lambda/bootstrap b/aws-lambda/bootstrap index e6820f0..2a98145 100755 --- a/aws-lambda/bootstrap +++ b/aws-lambda/bootstrap @@ -7,6 +7,13 @@ HANDLER_FILE=$(echo "$_HANDLER" | cut -d. -f1) API_ROOT=http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/ +# If this ENV variable is set then copy that directory as DENO_DIR (default = .deno_dir). +# Note: For permissions reasons we need the actual DENO_DIR to be somewhere in /tmp. +DENO_DIR=${DENO_DIR-'.deno_dir'} + +# TODO support bundle/js etc. +HANDLER_FILE=${HANDLER_FILE}.ts + # If we fail prior to the handler loop we post an init error. function error { echo "error:" $1 @@ -30,25 +37,25 @@ function investigate { $SCRIPT_DIR/amz-deno eval 'Deno.version.deno' \ || error "bad amz-deno executable" - [ -f $LAMBDA_TASK_ROOT/$HANDLER_FILE.ts ] \ - || error "missing expected handler file '$HANDLER_FILE.ts'" + [ -f $LAMBDA_TASK_ROOT/$HANDLER_FILE ] \ + || error "missing expected handler file '$HANDLER_FILE'" - DENO_DIR=/tmp/deno_dir NO_COLOR=true $SCRIPT_DIR/amz-deno fetch $LAMBDA_TASK_ROOT/$HANDLER_FILE.ts \ - || error "unable to compile $HANDLER_FILE.ts" + DENO_DIR=/tmp/deno_dir NO_COLOR=true $SCRIPT_DIR/amz-deno fetch $LAMBDA_TASK_ROOT/$HANDLER_FILE \ + || error "unable to compile $HANDLER_FILE" echo " - import { $HANDLER_NAME } from '$LAMBDA_TASK_ROOT/$HANDLER_FILE.ts'; + import { $HANDLER_NAME } from '$LAMBDA_TASK_ROOT/$HANDLER_FILE'; " > /tmp/runtime-test.js DENO_DIR=/tmp/deno_dir NO_COLOR=true $SCRIPT_DIR/amz-deno fetch /tmp/runtime-test.js 2> /dev/null \ - || error "$HANDLER_FILE.ts must export a function named '$HANDLER_NAME'" + || error "$HANDLER_FILE must export a function named '$HANDLER_NAME'" # perhaps a bug in bootstrap? } # Note: This is a js file to avoid a runtime compilation step. -# Hopefully $HANDLER_FILE.ts's compilation is cached in DENO_DIR. +# Hopefully $HANDLER_FILE's compilation is cached in DENO_DIR. echo " -import { $HANDLER_NAME } from '$LAMBDA_TASK_ROOT/$HANDLER_FILE.ts'; +import { $HANDLER_NAME } from '$LAMBDA_TASK_ROOT/$HANDLER_FILE'; const INVOCATION = '${API_ROOT}invocation/'; while (true) { const next = await fetch(INVOCATION + 'next'); @@ -111,10 +118,6 @@ while (true) { } " > /tmp/runtime.js -# If this ENV variable is set then copy that directory as DENO_DIR (default = .deno_dir). -# Note: For permissions reasons we need the actual DENO_DIR to be somewhere in /tmp. -DENO_DIR=${DENO_DIR-'.deno_dir'} - # We copy DENO_DIR into a writable directory (/tmp/deno_dir) # and expand DENO_DIR/LAMBDA_TASK_ROOT to match the new location ($LAMBDA_TASK_ROOT). mkdir -p /tmp/deno_dir/gen/file$LAMBDA_TASK_ROOT \