-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.template
More file actions
37 lines (23 loc) · 1.18 KB
/
Dockerfile.template
File metadata and controls
37 lines (23 loc) · 1.18 KB
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
# Use the official AWS Lambda adapter image to handle the Lambda runtime
FROM public.ecr.aws/awsguru/aws-lambda-adapter:0.9.0 AS aws-lambda-adapter
FROM oven/bun:slim AS bun_latest
# Set the work directory to `/var/task`. This is the default work directory for Lambda.
WORKDIR "/var/task"
COPY {{PACKAGE_JSON_PATH}} {{BUN_LOCK_PATH}} ./
RUN bun install --production --frozen-lockfile && \
rm -rf /root/.bun/install/cache && \
find node_modules -type d \( -name "test" -o -name "tests" -o -name "__tests__" -o -name "*.test.*" \) -exec rm -rf {} + 2>/dev/null || true && \
find node_modules -type f \( -name "*.md" -o -name "*.txt" -o -name "LICENSE" -o -name "CHANGELOG*" \) -delete 2>/dev/null || true && \
rm -f bun.lock
COPY {{CODE_PATH}} /var/task
{{COMPILE}}
FROM gcr.io/distroless/base:latest
# This will conditionally copy bun binary fron bun_latest if not compiling code
{{BUN_INSTALL}}
# Copy the Lambda adapter into the container
COPY --from=aws-lambda-adapter /lambda-adapter /opt/extensions/lambda-adapter
WORKDIR /var/task
COPY --from=bun_latest /var/task/ /var/task/
# Set the port to 8080. This is required for the AWS Lambda adapter.
ENV PORT=8080
{{COMMAND}}