-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile.pr
executable file
·66 lines (50 loc) · 1.97 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
# Form viewier that runs as a Lambda function. It is used to create
# Lambda function review environments for each PR.
FROM node:20 as build
ENV NODE_ENV=production
ENV NEXT_OUTPUT_STANDALONE=true
COPY . /src
WORKDIR /src
ARG COGNITO_APP_CLIENT_ID
ARG COGNITO_USER_POOL_ID
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:20 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 form-builder-templates ./form-builder-templates
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 apt-get update && apt-get install -y awscli
# 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"]