Skip to content

Node app build output files #13907

@Waleed-KH

Description

@Waleed-KH

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

If we have a Node app with build script that output to a specific folder (e.g. dist, .output ...):

var webClient = builder.AddNodeApp("webclient", "../WebClient", ".output/server/index.mjs")
	.WithRunScript("dev")
	.WithBuildScript("build");

It will deploy with all source files.

This happens cause the default Dockerfile builder has no info about the build output, so it copies everything to the runtime image:

.CopyFrom("build", "/app", "/app")

which result in a large container with source files, node_modules and dev dependencies that are not needed in runtime.

Describe the solution you'd like

Add new build output annotation that can be used by the default Dockerfile builder to determine which files need to be copied to the runtime image.

var webClient = builder.AddNodeApp("webclient", "../WebClient", ".output/server/index.mjs")
	.WithRunScript("dev")
	.WithBuildScript("build", outputFiles: [".output"]);

The alternative solution is for the user to use a custom Dockerfile in the Node app folder.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packagesjavascriptPull requests that update Javascript code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions