-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.prod
53 lines (36 loc) · 1.35 KB
/
Dockerfile.prod
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
44
45
46
47
48
49
50
51
52
53
FROM public.ecr.aws/docker/library/node:22-bookworm-slim AS base
# add aws-lambda-adapter extension
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.4 /lambda-adapter /opt/extensions/lambda-adapter
RUN mkdir /app
WORKDIR /app
RUN apt-get update && apt-get install -y curl jq && rm -rf /var/lib/apt/lists/*
FROM base AS npm
COPY package.json package-lock.json panda.config.ts ./
RUN npm ci
FROM base AS builder
COPY . .
COPY --from=npm /app/node_modules ./node_modules
# disables nextjs telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
ENV AWS_LWA_ENABLE_COMPRESSION=true
# build needs NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
RUN --mount=type=secret,id=envs \
export $(cat /run/secrets/envs) && \
npm run build
WORKDIR /app
FROM base AS release
ENV NODE_ENV=production
ENV PORT=8080
EXPOSE $PORT
COPY /bin/ /app/bin/
# copy static files and images from build
# This relies on the "standalone" nextjs build configuration
# if you receive errors about the ".next/standalone" directory not existing,
# check that `output: 'standalone'` is specified in the next.config file
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
RUN ln -s /tmp/cache ./.next/cache
CMD ["./bin/lambda-server"]