-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfileLambdaDemoApp
43 lines (33 loc) · 1.05 KB
/
DockerfileLambdaDemoApp
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
#
# Build the node.js app
#
# Build with whatever CPU the host OS has
FROM node:20-alpine AS node-build-env
# Set the working directory
WORKDIR /app
# Copy just files needed for npm install
COPY src/demo-app/package.json src/demo-app/package-lock.json ./
# Install dependencies
RUN npm ci
# Copy everything from the current directory to the working directory in the image
COPY src/demo-app/ ./
# Build the app
RUN npm run build
#
# During GitHub Actions this gets swapped in for the PR built extension, using sed
#
FROM lambda-dispatch-extension AS extension
#
# Runtime image for demo-app
#
FROM public.ecr.aws/lambda/nodejs:20
# Copy the build output from the build environment
# This is a self-contained single binary file
COPY --from=extension /lambda-dispatch /opt/extensions/lambda-dispatch
# Copy the node.js app
COPY --from=node-build-env /app/dist/ dist/
# This is only used for testing with docker-compose
# It is not necessary to copy this into an app deployed on Lambda
COPY extension/startup.sh ./
# Set the entrypoint
ENTRYPOINT ["node", "dist/app.cjs"]