sst 2.22.7 → 2.22.8

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.
@@ -554,6 +554,16 @@ export interface ContainerProps {
554
554
  * ```
555
555
  */
556
556
  cmd?: string[];
557
+ /**
558
+ * Name of the Dockerfile.
559
+ * @example
560
+ * ```js
561
+ * container: {
562
+ * file: "path/to/Dockerfile.prod"
563
+ * }
564
+ * ```
565
+ */
566
+ file?: string;
557
567
  }
558
568
  /**
559
569
  * Used to configure additional files to copy into the function bundle
@@ -198,6 +198,9 @@ export class Function extends CDKFunction {
198
198
  ? { platform: Platform.custom(architecture.dockerPlatform) }
199
199
  : {}),
200
200
  ...(props.container?.cmd ? { cmd: props.container.cmd } : {}),
201
+ ...(props.container?.file
202
+ ? { file: props.container.file }
203
+ : {}),
201
204
  }),
202
205
  handler: CDKHandler.FROM_IMAGE,
203
206
  runtime: CDKRuntime.FROM_IMAGE,
@@ -21,6 +21,16 @@ export interface JobContainerProps {
21
21
  * ```
22
22
  */
23
23
  cmd: string[];
24
+ /**
25
+ * Name of the Dockerfile.
26
+ * @example
27
+ * ```js
28
+ * container: {
29
+ * file: "path/to/Dockerfile.prod"
30
+ * }
31
+ * ```
32
+ */
33
+ file?: string;
24
34
  }
25
35
  export interface JobProps {
26
36
  /**
package/constructs/Job.js CHANGED
@@ -209,6 +209,7 @@ export class Job extends Construct {
209
209
  platform: architecture === "arm_64"
210
210
  ? Platform.custom("linux/arm64")
211
211
  : Platform.custom("linux/amd64"),
212
+ file: container?.file,
212
213
  });
213
214
  image.repository?.grantPull(this.job.role);
214
215
  const project = this.job.node.defaultChild;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.22.7",
4
+ "version": "2.22.8",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -52,7 +52,14 @@ export const useContainerHandler = Context.memo(async () => {
52
52
  sources.set(input.functionID, project);
53
53
  if (input.mode === "start") {
54
54
  try {
55
- const result = await execAsync(`docker build -t sst-dev:${input.functionID} .`, {
55
+ const result = await execAsync([
56
+ `docker build`,
57
+ `-t sst-dev:${input.functionID}`,
58
+ ...(input.props.container?.file
59
+ ? [`-f ${input.props.container.file}`]
60
+ : []),
61
+ `.`,
62
+ ].join(" "), {
56
63
  cwd: project,
57
64
  env: {
58
65
  ...process.env,
@@ -74,6 +81,9 @@ export const useContainerHandler = Context.memo(async () => {
74
81
  await execAsync([
75
82
  `docker build`,
76
83
  `-t sst-build:${input.functionID}`,
84
+ ...(input.props.container?.file
85
+ ? [`-f ${input.props.container.file}`]
86
+ : []),
77
87
  `--platform ${platform}`,
78
88
  `.`,
79
89
  ].join(" "), {
package/sst.mjs CHANGED
@@ -4929,7 +4929,12 @@ var init_container = __esm({
4929
4929
  if (input.mode === "start") {
4930
4930
  try {
4931
4931
  const result = await execAsync(
4932
- `docker build -t sst-dev:${input.functionID} .`,
4932
+ [
4933
+ `docker build`,
4934
+ `-t sst-dev:${input.functionID}`,
4935
+ ...input.props.container?.file ? [`-f ${input.props.container.file}`] : [],
4936
+ `.`
4937
+ ].join(" "),
4933
4938
  {
4934
4939
  cwd: project,
4935
4940
  env: {
@@ -4951,6 +4956,7 @@ var init_container = __esm({
4951
4956
  [
4952
4957
  `docker build`,
4953
4958
  `-t sst-build:${input.functionID}`,
4959
+ ...input.props.container?.file ? [`-f ${input.props.container.file}`] : [],
4954
4960
  `--platform ${platform}`,
4955
4961
  `.`
4956
4962
  ].join(" "),