-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile.pr
executable file
·70 lines (53 loc) · 2.21 KB
/
Dockerfile.pr
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Form viewier that runs as a Lambda function. It is used to create
# Lambda function review environments for each PR.
FROM node:22-alpine as build
ENV NODE_ENV=production
ENV NEXT_OUTPUT_STANDALONE=true
ENV NEXT_PUBLIC_ADDRESSCOMPLETE_API_KEY=UR78-BU29-RU35-EP49
# Address Complete API key is domain locked, and provided to the client browser, where the API is processed.
COPY . /src
WORKDIR /src
ARG COGNITO_APP_CLIENT_ID
ARG COGNITO_USER_POOL_ID
ARG NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
ENV NEXT_SERVER_ACTIONS_ENCRYPTION_KEY=$NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
ARG INDEX_SITE="false"
ENV INDEX_SITE=$INDEX_SITE
RUN corepack enable && yarn set version berry
RUN yarn workspaces focus gcforms flag_initialization
RUN yarn build
FROM node:22-alpine as final
LABEL maintainer="-"
ARG COGNITO_APP_CLIENT_ID
ENV COGNITO_APP_CLIENT_ID=$COGNITO_APP_CLIENT_ID
ARG COGNITO_USER_POOL_ID
ENV COGNITO_USER_POOL_ID=$COGNITO_USER_POOL_ID
ARG INDEX_SITE="false"
ENV INDEX_SITE=$INDEX_SITE
ARG TAG_VERSION
ENV TAG_VERSION=$TAG_VERSION
ENV AWS_LWA_ENABLE_COMPRESSION=true
ENV HOSTNAME=localhost
ENV PORT=3000
# Use the REVIEW_ENV environment variable to determine if the app is running in a review environment
# Enables memory caching for the prerendering of pages
ENV REVIEW_ENV=1
WORKDIR /src
COPY --from=build /src/.next/standalone ./
COPY --from=build /src/.next/static ./.next/static
COPY package.json yarn.lock .yarnrc.yml next.config.mjs ./
COPY .yarn ./.yarn
COPY public ./public
COPY prisma ./prisma
COPY bin/pr-review-entrypoint.sh ./entrypoint.sh
# Update to latest yarn version
RUN corepack enable && yarn set version berry
# Required by the entrypoint.sh to load the SSM ParameterStore environment variables
RUN apk update && apk add --no-cache aws-cli
# Lambda web adapter: https://github.com/awslabs/aws-lambda-web-adapter
# The public.ecr.aws/awsguru/aws-lambda-adapter:0.7.0 image reference in the docs has
# been pushed to the public CDS ECR to avoid rate limiting when pulling the image.
COPY --from=public.ecr.aws/cds-snc/aws-lambda-adapter:0.7.0@sha256:00b1441858fb3f4ce3d67882ef6153bacf8ff4bb8bf271750c133667202926af /lambda-adapter /opt/extensions/lambda-adapter
RUN ln -s /tmp ./.next/cache
EXPOSE 3000
ENTRYPOINT ["./entrypoint.sh"]