cdk-nextjs 0.3.11 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.jsii +1248 -748
  2. package/API.md +1033 -531
  3. package/README.md +1 -2
  4. package/assets/lambdas/assets-deployment/assets-deployment.lambda/assets-deployment.Dockerfile +12 -8
  5. package/assets/lambdas/assets-deployment/assets-deployment.lambda/index.js +67 -56
  6. package/assets/lambdas/post-deploy/post-deploy.lambda/index.js +246 -0
  7. package/docs/breaking-changes.md +9 -0
  8. package/docs/notes.md +170 -20
  9. package/lib/constants.d.ts +32 -0
  10. package/lib/constants.js +38 -0
  11. package/lib/generated-structs/OptionalCustomResourceProps.d.ts +104 -0
  12. package/lib/generated-structs/OptionalCustomResourceProps.js +3 -0
  13. package/lib/generated-structs/OptionalDockerImageAssetProps.d.ts +21 -0
  14. package/lib/generated-structs/OptionalDockerImageAssetProps.js +1 -1
  15. package/lib/generated-structs/OptionalNextjsAssetsDeploymentProps.d.ts +4 -3
  16. package/lib/generated-structs/OptionalNextjsAssetsDeploymentProps.js +1 -1
  17. package/lib/generated-structs/OptionalNextjsBuildProps.d.ts +1 -1
  18. package/lib/generated-structs/OptionalNextjsBuildProps.js +1 -1
  19. package/lib/generated-structs/OptionalNextjsContainersProps.d.ts +3 -3
  20. package/lib/generated-structs/OptionalNextjsContainersProps.js +1 -1
  21. package/lib/generated-structs/OptionalNextjsPostDeployProps.d.ts +42 -0
  22. package/lib/generated-structs/OptionalNextjsPostDeployProps.js +3 -0
  23. package/lib/generated-structs/OptionalPostDeployCustomResourceProperties.d.ts +41 -0
  24. package/lib/generated-structs/OptionalPostDeployCustomResourceProperties.js +4 -0
  25. package/lib/index.d.ts +6 -5
  26. package/lib/index.js +6 -8
  27. package/lib/lambdas/assets-deployment/assets-deployment.lambda.js +5 -23
  28. package/lib/lambdas/assets-deployment/fs-to-fs.js +18 -3
  29. package/lib/lambdas/assets-deployment/fs-to-s3.d.ts +8 -2
  30. package/lib/lambdas/assets-deployment/fs-to-s3.js +14 -8
  31. package/lib/lambdas/post-deploy/create-invalidation.d.ts +2 -0
  32. package/lib/lambdas/post-deploy/create-invalidation.js +19 -0
  33. package/lib/lambdas/post-deploy/post-deploy-function.d.ts +13 -0
  34. package/lib/lambdas/post-deploy/post-deploy-function.js +22 -0
  35. package/lib/lambdas/post-deploy/post-deploy.lambda.d.ts +9 -0
  36. package/lib/lambdas/post-deploy/post-deploy.lambda.js +56 -0
  37. package/lib/lambdas/post-deploy/prune-fs.d.ts +10 -0
  38. package/lib/lambdas/post-deploy/prune-fs.js +33 -0
  39. package/lib/lambdas/post-deploy/prune-s3.d.ts +15 -0
  40. package/lib/lambdas/post-deploy/prune-s3.js +101 -0
  41. package/lib/lambdas/utils.js +35 -0
  42. package/lib/nextjs-assets-deployment.d.ts +15 -51
  43. package/lib/nextjs-assets-deployment.js +27 -25
  44. package/lib/nextjs-build/builder.Dockerfile +12 -8
  45. package/lib/nextjs-build/cdk-nextjs-cache-handler.cjs +63 -0
  46. package/lib/nextjs-build/cdk-nextjs-cache-handler.d.ts +21 -0
  47. package/lib/nextjs-build/cdk-nextjs-cache-handler.js +49 -0
  48. package/lib/nextjs-build/global-containers.Dockerfile +29 -19
  49. package/lib/nextjs-build/global-functions.Dockerfile +30 -24
  50. package/lib/nextjs-build/nextjs-build.d.ts +51 -26
  51. package/lib/nextjs-build/nextjs-build.js +108 -88
  52. package/lib/nextjs-build/regional-containers.Dockerfile +30 -20
  53. package/lib/nextjs-compute/nextjs-compute-base-props.d.ts +0 -1
  54. package/lib/nextjs-compute/nextjs-compute-base-props.js +1 -1
  55. package/lib/nextjs-compute/nextjs-containers.d.ts +2 -1
  56. package/lib/nextjs-compute/nextjs-containers.js +7 -5
  57. package/lib/nextjs-compute/nextjs-functions.d.ts +1 -0
  58. package/lib/nextjs-compute/nextjs-functions.js +8 -11
  59. package/lib/nextjs-distribution.d.ts +1 -1
  60. package/lib/nextjs-distribution.js +4 -4
  61. package/lib/nextjs-file-system.js +1 -1
  62. package/lib/nextjs-post-deploy.d.ts +101 -0
  63. package/lib/nextjs-post-deploy.js +78 -0
  64. package/lib/nextjs-static-assets.js +1 -1
  65. package/lib/nextjs-vpc.d.ts +1 -1
  66. package/lib/nextjs-vpc.js +4 -4
  67. package/lib/root-constructs/nextjs-base-overrides.d.ts +4 -0
  68. package/lib/root-constructs/nextjs-base-overrides.js +1 -1
  69. package/lib/root-constructs/nextjs-base-props.d.ts +15 -7
  70. package/lib/root-constructs/nextjs-base-props.js +1 -1
  71. package/lib/root-constructs/nextjs-global-containers.d.ts +8 -8
  72. package/lib/root-constructs/nextjs-global-containers.js +25 -15
  73. package/lib/root-constructs/nextjs-global-functions.d.ts +8 -11
  74. package/lib/root-constructs/nextjs-global-functions.js +25 -25
  75. package/lib/root-constructs/nextjs-regional-containers.d.ts +8 -0
  76. package/lib/root-constructs/nextjs-regional-containers.js +26 -9
  77. package/lib/utils/get-architecture.d.ts +2 -0
  78. package/lib/utils/get-architecture.js +8 -0
  79. package/lib/utils/handle-deprecated-properties.d.ts +7 -0
  80. package/lib/utils/handle-deprecated-properties.js +14 -0
  81. package/package.json +17 -19
  82. package/assets/lambdas/revalidate/revalidate.lambda/index.js +0 -67
  83. package/lib/common.d.ts +0 -25
  84. package/lib/common.js +0 -30
  85. package/lib/generated-structs/OptionalNextjsInvalidationProps.d.ts +0 -11
  86. package/lib/generated-structs/OptionalNextjsInvalidationProps.js +0 -3
  87. package/lib/lambdas/assets-deployment/prune-s3.d.ts +0 -15
  88. package/lib/lambdas/assets-deployment/prune-s3.js +0 -42
  89. package/lib/lambdas/assets-deployment/s3.d.ts +0 -2
  90. package/lib/lambdas/assets-deployment/s3.js +0 -7
  91. package/lib/lambdas/assets-deployment/utils.js +0 -35
  92. package/lib/lambdas/revalidate/revalidate-function.d.ts +0 -13
  93. package/lib/lambdas/revalidate/revalidate-function.js +0 -22
  94. package/lib/lambdas/revalidate/revalidate.lambda.d.ts +0 -2
  95. package/lib/lambdas/revalidate/revalidate.lambda.js +0 -53
  96. package/lib/nextjs-build/add-cache-handler.d.ts +0 -1
  97. package/lib/nextjs-build/add-cache-handler.js +0 -23
  98. package/lib/nextjs-build/add-cache-handler.mjs +0 -18
  99. package/lib/nextjs-build/cache-handler.cjs +0 -21878
  100. package/lib/nextjs-build/cache-handler.d.ts +0 -6
  101. package/lib/nextjs-build/cache-handler.js +0 -26
  102. package/lib/nextjs-invalidation.d.ts +0 -19
  103. package/lib/nextjs-invalidation.js +0 -52
  104. package/lib/nextjs-revalidation.d.ts +0 -30
  105. package/lib/nextjs-revalidation.js +0 -65
  106. /package/lib/lambdas/{assets-deployment/utils.d.ts → utils.d.ts} +0 -0
@@ -1,10 +1,10 @@
1
1
  #checkov:skip=CKV_DOCKER_2: healthcheck run by ALB and ECS
2
2
  #checkov:skip=CKV_DOCKER_7: latest tag is ok to use for local builder container
3
3
  # Modified from: https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
4
- ARG BUILDER_IMAGE_TAG
5
- FROM $BUILDER_IMAGE_TAG as builder
4
+ ARG BUILDER_IMAGE_ALIAS=cdk-nextjs/builder:latest
5
+ FROM $BUILDER_IMAGE_ALIAS AS builder
6
6
  # Production image, copy all the files and run next
7
- FROM public.ecr.aws/docker/library/node:22-alpine as runner
7
+ FROM public.ecr.aws/docker/library/node:22-alpine AS runner
8
8
  WORKDIR /app
9
9
 
10
10
  ENV NODE_ENV production
@@ -14,23 +14,33 @@ ENV NODE_ENV production
14
14
  RUN addgroup --system --gid 1001 nodejs
15
15
  RUN adduser --system --uid 1001 nextjs
16
16
 
17
- ARG RELATIVE_PATH_TO_WORKSPACE
18
- COPY --from=builder --chown=nextjs:nodejs /app/$RELATIVE_PATH_TO_WORKSPACE/.next/standalone ./
17
+ ARG RELATIVE_PATH_TO_PACKAGE
18
+ COPY --from=builder --chown=nextjs:nodejs /app/$RELATIVE_PATH_TO_PACKAGE/.next/standalone ./
19
+ # html,rsc,body,meta files don't need to be in compute container b/c they're handled by cdk-nextjs-cache-handler.cjs
20
+ RUN find . -type f \( -name "*.html" -o -name "*.rsc" -name "*.body" -name "*.meta" \) -delete
21
+ COPY --from=builder --chown=nextjs:nodejs /app/cdk-nextjs-cache-handler.cjs ./$RELATIVE_PATH_TO_PACKAGE/
22
+ ARG BUILD_ID
23
+ ARG CACHE_PATH
24
+ ARG DATA_CACHE_PATH
25
+ ARG IMAGE_CACHE_PATH
19
26
  ARG MOUNT_PATH
20
- ARG DATA_CACHE_DIR
21
- ARG FULL_ROUTE_CACHE_DIR
22
- ARG IMAGE_CACHE_DIR
23
- ARG PUBLIC_DIR
24
- RUN mkdir -p $MOUNT_PATH/$DATA_CACHE_DIR && \
25
- mkdir -p $MOUNT_PATH/$FULL_ROUTE_CACHE_DIR && \
26
- mkdir -p $MOUNT_PATH/$IMAGE_CACHE_DIR && \
27
- mkdir -p $MOUNT_PATH/$PUBLIC_DIR && \
28
- chmod -R u+rw $MOUNT_PATH && \
29
- mkdir -p ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache && \
30
- ln -s $MOUNT_PATH/$DATA_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache/fetch-cache && \
31
- ln -s $MOUNT_PATH/$IMAGE_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache/images && \
32
- ln -s $MOUNT_PATH/$PUBLIC_DIR ./$RELATIVE_PATH_TO_WORKSPACE/public && \
33
- ln -s $MOUNT_PATH/$FULL_ROUTE_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/server/app
27
+ ARG PUBLIC_PATH
28
+ RUN sed -i 's/"env":{},/"env":{},cacheHandler:"\.\.\/cdk-nextjs-cache-handler.cjs",/g' ./$RELATIVE_PATH_TO_PACKAGE/server.js && \
29
+ # locally in this docker image the paths where EFS will be mounted need to exist for symlinks to be made
30
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$DATA_CACHE_PATH && \
31
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$IMAGE_CACHE_PATH && \
32
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$PUBLIC_PATH && \
33
+ # delete if exists so that symlinks can be made; image cache doesn't exist at build time
34
+ rm -rf ./$RELATIVE_PATH_TO_PACKAGE/$DATA_CACHE_PATH && \
35
+ rm -rf ./$RELATIVE_PATH_TO_PACKAGE/$PUBLIC_PATH && \
36
+ # create .next/cache if doesn't exist. won't exist if no cached fetch data.
37
+ mkdir -p ./$RELATIVE_PATH_TO_PACKAGE/$CACHE_PATH && \
38
+ # `ln -s <src_file> <target_file>` such that accessing <target_file> accesses <src_file>
39
+ ln -s $MOUNT_PATH/$BUILD_ID/$DATA_CACHE_PATH ./$RELATIVE_PATH_TO_PACKAGE/$DATA_CACHE_PATH && \
40
+ ln -s $MOUNT_PATH/$BUILD_ID/$IMAGE_CACHE_PATH ./$RELATIVE_PATH_TO_PACKAGE/$IMAGE_CACHE_PATH && \
41
+ ln -s $MOUNT_PATH/$BUILD_ID/$PUBLIC_PATH ./$RELATIVE_PATH_TO_PACKAGE/$PUBLIC_PATH && \
42
+ # chown needs to be at end after all files are added so that nextjs:nodejs can access all files
43
+ chown -R nextjs:nodejs $MOUNT_PATH/$BUILD_ID
34
44
 
35
45
  USER nextjs
36
46
 
@@ -1,12 +1,11 @@
1
1
  #checkov:skip=CKV_DOCKER_2: healthcheck run by AWS Lambda Web Adapter
2
2
  #checkov:skip=CKV_DOCKER_7: latest tag is ok to use for local builder container
3
3
  # Modified from: https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
4
- ARG BUILDER_IMAGE_TAG
5
- FROM $BUILDER_IMAGE_TAG as builder
4
+ ARG BUILDER_IMAGE_ALIAS=cdk-nextjs/builder:latest
5
+ FROM $BUILDER_IMAGE_ALIAS AS builder
6
6
  # Production image, copy all the files and run next
7
- FROM public.ecr.aws/docker/library/node:22-alpine as runner
8
- ARG MOUNT_PATH
9
- COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.3 /lambda-adapter /opt/extensions/lambda-adapter
7
+ FROM public.ecr.aws/docker/library/node:22-alpine AS runner
8
+ COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter
10
9
  WORKDIR /app
11
10
 
12
11
  ENV NODE_ENV production
@@ -16,26 +15,33 @@ ENV NODE_ENV production
16
15
  RUN addgroup --system --gid 1001 nodejs
17
16
  RUN adduser --system --uid 1001 nextjs
18
17
 
19
- ARG RELATIVE_PATH_TO_WORKSPACE
20
- COPY --from=builder --chown=nextjs:nodejs /app/$RELATIVE_PATH_TO_WORKSPACE/.next/standalone ./
21
- COPY --chown=nextjs:nodejs ./add-cache-handler.mjs ./cache-handler.cjs ./
18
+ ARG RELATIVE_PATH_TO_PACKAGE
19
+ COPY --from=builder --chown=nextjs:nodejs /app/$RELATIVE_PATH_TO_PACKAGE/.next/standalone ./
20
+ # html,rsc,body,meta files don't need to be in compute container b/c they're handled by cdk-nextjs-cache-handler.cjs
21
+ RUN find . -type f \( -name "*.html" -o -name "*.rsc" -name "*.body" -name "*.meta" \) -delete
22
+ COPY --from=builder --chown=nextjs:nodejs /app/cdk-nextjs-cache-handler.cjs ./$RELATIVE_PATH_TO_PACKAGE/
23
+ ARG BUILD_ID
24
+ ARG CACHE_PATH
25
+ ARG DATA_CACHE_PATH
26
+ ARG IMAGE_CACHE_PATH
22
27
  ARG MOUNT_PATH
23
- ARG DATA_CACHE_DIR
24
- ARG FULL_ROUTE_CACHE_DIR
25
- ARG IMAGE_CACHE_DIR
26
- ARG PUBLIC_DIR
27
- RUN node add-cache-handler.mjs ./$RELATIVE_PATH_TO_WORKSPACE/.next/required-server-files.json && \
28
- rm add-cache-handler.mjs && \
29
- mkdir -p $MOUNT_PATH/$DATA_CACHE_DIR && \
30
- mkdir -p $MOUNT_PATH/$FULL_ROUTE_CACHE_DIR && \
31
- mkdir -p $MOUNT_PATH/$IMAGE_CACHE_DIR && \
32
- mkdir -p $MOUNT_PATH/$PUBLIC_DIR && \
33
- chmod -R u+rw $MOUNT_PATH && \
34
- mkdir -p ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache && \
35
- ln -s $MOUNT_PATH/$DATA_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache/fetch-cache && \
36
- ln -s $MOUNT_PATH/$IMAGE_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/cache/images && \
37
- ln -s $MOUNT_PATH/$PUBLIC_DIR ./$RELATIVE_PATH_TO_WORKSPACE/public && \
38
- ln -s $MOUNT_PATH/$FULL_ROUTE_CACHE_DIR ./$RELATIVE_PATH_TO_WORKSPACE/.next/server/app
28
+ ARG PUBLIC_PATH
29
+ RUN sed -i 's/"env":{},/"env":{},cacheHandler:"\.\.\/cdk-nextjs-cache-handler.cjs",/g' ./$RELATIVE_PATH_TO_PACKAGE/server.js && \
30
+ # locally in this docker image the paths where EFS will be mounted need to exist for symlinks to be made
31
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$DATA_CACHE_PATH && \
32
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$IMAGE_CACHE_PATH && \
33
+ mkdir -p $MOUNT_PATH/$BUILD_ID/$PUBLIC_PATH && \
34
+ # delete if exists so that symlinks can be made; image cache doesn't exist at build time
35
+ rm -rf ./$RELATIVE_PATH_TO_PACKAGE/$DATA_CACHE_PATH && \
36
+ rm -rf ./$RELATIVE_PATH_TO_PACKAGE/$PUBLIC_PATH && \
37
+ # create .next/cache if doesn't exist. won't exist if no cached fetch data.
38
+ mkdir -p ./$RELATIVE_PATH_TO_PACKAGE/$CACHE_PATH && \
39
+ # `ln -s <src_file> <target_file>` such that accessing <target_file> accesses <src_file>
40
+ ln -s $MOUNT_PATH/$BUILD_ID/$DATA_CACHE_PATH ./$RELATIVE_PATH_TO_PACKAGE/$DATA_CACHE_PATH && \
41
+ ln -s $MOUNT_PATH/$BUILD_ID/$IMAGE_CACHE_PATH ./$RELATIVE_PATH_TO_PACKAGE/$IMAGE_CACHE_PATH && \
42
+ ln -s $MOUNT_PATH/$BUILD_ID/$PUBLIC_PATH ./$RELATIVE_PATH_TO_PACKAGE/$PUBLIC_PATH && \
43
+ # chown needs to be at end after all files are added so that nextjs:nodejs can access all files
44
+ chown -R nextjs:nodejs $MOUNT_PATH/$BUILD_ID
39
45
 
40
46
  USER nextjs
41
47
 
@@ -1,7 +1,7 @@
1
1
  import { DockerImageAsset, Platform } from "aws-cdk-lib/aws-ecr-assets";
2
2
  import { AssetImageCodeProps, DockerImageCode } from "aws-cdk-lib/aws-lambda";
3
3
  import { Construct } from "constructs";
4
- import { NextjsType } from "../common";
4
+ import { NextjsType } from "../constants";
5
5
  import { OptionalDockerImageAssetProps } from "../generated-structs/OptionalDockerImageAssetProps";
6
6
  import { NextjsBaseProps } from "../root-constructs/nextjs-base-props";
7
7
  export interface BuilderImageProps {
@@ -33,7 +33,8 @@ export interface BuilderImageProps {
33
33
  */
34
34
  readonly exclude?: string[];
35
35
  /**
36
- * Name of Dockerfile
36
+ * Name of Dockerfile in builder build context. If specified, you are responsible
37
+ * for ensuring it exists in build context before construct is instantiated.
37
38
  * @default "builder.Dockerfile"
38
39
  */
39
40
  readonly file?: string;
@@ -43,16 +44,41 @@ export interface BuilderImageProps {
43
44
  * @default false
44
45
  */
45
46
  readonly skipBuild?: boolean;
46
- /**
47
- * Path to your custom builder.Dockerfile which will be copied into {@link NextBaseProps.buildContext}.
48
- * It is recommended to override this prop to optimize build caching for your setup.
49
- */
50
- readonly customDockerfilePath?: string;
51
47
  }
52
48
  export interface NextjsBuildOverrides {
53
49
  readonly nextjsContainersDockerImageAssetProps?: OptionalDockerImageAssetProps;
54
50
  readonly nextjsFunctionsAssetImageCodeProps?: AssetImageCodeProps;
55
51
  readonly nextjsAssetDeploymentAssetImageCodeProps?: AssetImageCodeProps;
52
+ /**
53
+ * Default folder for build context is the "lib/nextjs-build" folder in the
54
+ * installed cdk-nextjs library which has the "global-functions.Dockerfile".
55
+ * Note, if you specify this then you're responsible for ensuring the dockerfile
56
+ * is present in the build context directory and any referenced files are
57
+ * present as well. You can specify dockerfile name with adjacent
58
+ * `nextjsFunctionsAssetImageCodeProps.file` property.
59
+ * @default "cdk-nextjs/lib/nextjs-build"
60
+ */
61
+ readonly functionsImageBuildContext?: string;
62
+ /**
63
+ * Default folder for build context is the "lib/nextjs-build" folder in the
64
+ * installed cdk-nextjs library which has the "assets-deployment.Dockerfile".
65
+ * Note, if you specify this then you're responsible for ensuring the dockerfile
66
+ * is present in the build context directory and any referenced files are
67
+ * present as well. You can specify dockerfile name with adjacent
68
+ * `nextjsAssetDeploymentAssetImageCodeProps.file` property.
69
+ * @default "cdk-nextjs/lib/nextjs-build"
70
+ */
71
+ readonly assetsDeploymentImageBuildContext?: string;
72
+ /**
73
+ * Default folder for build context is the "assets/lambdas/assets-deployment/assets-deployment.lambda" folder in the
74
+ * installed cdk-nextjs library which has the "{...}-containers.Dockerfile".
75
+ * Note, if you specify this then you're responsible for ensuring the dockerfile
76
+ * is present in the build context directory and any referenced files are
77
+ * present as well. You can specify dockerfile name with adjacent
78
+ * `nextjsContainersDockerImageAssetProps.file` property.
79
+ * @default "cdk-nextjs/lib/nextjs-build"
80
+ */
81
+ readonly containersImageBuildContext?: string;
56
82
  }
57
83
  export interface NextjsBuildProps {
58
84
  /**
@@ -68,9 +94,9 @@ export interface NextjsBuildProps {
68
94
  */
69
95
  readonly builderImageProps?: BuilderImageProps;
70
96
  /**
71
- * @see {@link NextjsBaseProps.relativePathToWorkspace}
97
+ * @see {@link NextjsBaseProps.relativePathToPackage}
72
98
  */
73
- readonly relativePathToWorkspace?: NextjsBaseProps["relativePathToWorkspace"];
99
+ readonly relativePathToPackage?: NextjsBaseProps["relativePathToPackage"];
74
100
  readonly nextjsType: NextjsType;
75
101
  readonly overrides?: NextjsBuildOverrides;
76
102
  }
@@ -83,22 +109,23 @@ export interface PublicDirEntry {
83
109
  * @link https://nextjs.org/docs/pages/api-reference/next-config-js/output
84
110
  */
85
111
  export declare class NextjsBuild extends Construct {
112
+ /**
113
+ * Image alias of builder image Next.js app which is built for other images to be
114
+ * built `FROM`. This image isn't built with CDK Assets construct b/c it
115
+ * doesn't need to be uploaded to ECR. We still need to include slice of
116
+ * `node.addr` in tag in case multiple cdk-nextjs constructs are used.
117
+ */
118
+ builderImageAlias: string;
119
+ /**
120
+ * Unique id for Next.js build. Used to partition EFS FileSystem.
121
+ */
122
+ buildId: string;
86
123
  /**
87
124
  * Hash of builder image which will change whenever the image changes. Useful
88
125
  * for passing to properties of custom resources that depend upon the builder
89
126
  * image to re-run when build image changes.
90
127
  */
91
128
  buildImageDigest: string;
92
- /**
93
- * Mount path in container for EFS. Next.js image optimization, data, and full
94
- * route cache will be symlinked to this location.
95
- *
96
- * Must comply with pattern: ^/mnt/[a-zA-Z0-9-_.]+$ due to lambda requirement.
97
- * Fargate doesn't have this same requirement but we share code for lambda and
98
- * fargate.
99
- * @see https://docs.aws.amazon.com/lambda/latest/api/API_FileSystemConfig.html
100
- */
101
- containerMountPathForEfs: string;
102
129
  /**
103
130
  * Docker image built if using Fargate.
104
131
  */
@@ -124,15 +151,12 @@ export declare class NextjsBuild extends Construct {
124
151
  */
125
152
  relativePathToEntrypoint: string;
126
153
  /**
127
- * Tag of builder image Next.js app which is built for other images to be
128
- * built `FROM`. This image isn't built with CDK Assets construct b/c it
129
- * doesn't need to be uploaded to ECR. We still need to include slice of
130
- * `node.addr` in tag in case multiple cdk-nextjs constructs are used.
154
+ * Repository name for the builder image.
131
155
  */
132
- private builderImageTag;
156
+ private builderImageRepo;
133
157
  private containerRuntime;
134
158
  private props;
135
- private relativePathToWorkspace;
159
+ private relativePathToPackage;
136
160
  constructor(scope: Construct, id: string, props: NextjsBuildProps);
137
161
  private getRelativeEntrypointPath;
138
162
  /**
@@ -142,10 +166,11 @@ export declare class NextjsBuild extends Construct {
142
166
  * it with `execSync` and other images will be built `FROM` it.
143
167
  */
144
168
  private createBuilderImage;
169
+ private injectBuilderDockerfileEnvVars;
145
170
  private createBuildArgStr;
146
- private createLoadEnvVarsScript;
147
171
  private getBuilderImageDigest;
148
172
  private getPublicDirEntries;
173
+ private getBuildId;
149
174
  private createImageForNextjsContainers;
150
175
  private createImageForNextjsFunctions;
151
176
  private createImageForNextjsAssetsDeployment;