-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
43 lines (31 loc) · 1.52 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM node:18.8.0-slim
LABEL description="This container serves as an entry point for our future Snek Function projects."
LABEL org.opencontainers.image.source="https://github.com/snek-functions/origin"
LABEL maintainer="[email protected]"
ENV LAMBDA_TASK_ROOT=/var/task \
SNEK_FUNCTIONS_BUILD_DIR=/tmp/snek-functions
WORKDIR ${LAMBDA_TASK_ROOT}
COPY --from=amazon/aws-lambda-nodejs:latest /usr/local/bin/aws-lambda-rie /usr/local/bin/aws-lambda-rie
COPY --from=amazon/aws-lambda-nodejs:latest /var/runtime /var/runtime
COPY --from=amazon/aws-lambda-nodejs:latest /var/lang /var/lang
COPY --from=amazon/aws-lambda-nodejs:latest lambda-entrypoint.sh .
COPY --from=amazon/aws-lambda-nodejs:latest /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt
# Override /bin/sh because some scripts are only compatible with the amazon version
COPY --from=amazon/aws-lambda-nodejs:latest /bin/sh /bin/sh
# Add static files from . to task root
COPY package.json entrypoint.sh ${LAMBDA_TASK_ROOT}/
# Copy all files form the . to the build dir
COPY ./ ${SNEK_FUNCTIONS_BUILD_DIR}/
RUN chmod +x entrypoint.sh
WORKDIR ${SNEK_FUNCTIONS_BUILD_DIR}
RUN ln -s /usr/local/bin/node /var/lang/bin/node ;\
npm install ;\
npx snek-functions build --functions-path . ;\
# Copy the built functions to the lambda function
cp -r dist node_modules ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
ENTRYPOINT [ "./entrypoint.sh" ]
# Start in serverless mode
#CMD [ "app.handler" ]
# SPDX-License-Identifier: (EUPL-1.2)
# Copyright © 2022 snek.at