Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.1.0" />
<PackageReference Include="Aspire.Hosting.Azure" Version="9.1.0" />
<PackageReference Include="Aspire.Hosting.NodeJs" Version="9.1.0" />
<PackageReference Include="CommunityToolkit.Aspire.Hosting.NodeJS.Extensions" Version="9.2.1" />
</ItemGroup>

</Project>
15 changes: 12 additions & 3 deletions samples/FullStackJS/FullStackJS.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
using Microsoft.Extensions.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

var api = builder.AddNpmApp("api", "../api", "run")
.WithHttpEndpoint(env: "PORT");
var api = builder.AddNpmApp("api", "../api")
.WithNpmPackageInstallation()
.WithExternalHttpEndpoints()
.PublishAsDockerFile();

_ = builder.Environment.IsDevelopment()
? api.WithHttpEndpoint(env: "PORT")
: api.WithHttpsEndpoint(env: "PORT");

builder.AddNpmApp("app", "../app")
.WithNpmPackageInstallation()
.WithReference(api)
.WaitFor(api)
.WithEnvironment("BROWSER", "none") // Disable opening browser on npm start
.WithEnvironment("BROWSER", "none")
.WithHttpEndpoint(env: "PORT")
.WithExternalHttpEndpoints()
.PublishAsDockerFile();
Expand Down
22 changes: 22 additions & 0 deletions samples/FullStackJS/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:23-alpine as build

WORKDIR /app

COPY package.json package.json
COPY package-lock.json package-lock.json

RUN npm install

COPY . .

RUN npm run build

FROM node:23-alpine

WORKDIR /app

COPY --from=build /app .

EXPOSE 3000

CMD ["npm", "start"]
Loading
Loading