Skip to content
Merged
Changes from all commits
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
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# syntax=docker/dockerfile:1
FROM node:24-bookworm-slim AS node-build
WORKDIR /App

# Build javascript library. The npm cache mount speeds up repeated local builds.
COPY . ./
RUN --mount=type=cache,id=try-npm,target=/root/.npm \
/App/build-js.sh

FROM mcr.microsoft.com/dotnet/sdk:10.0-azurelinux3.0 AS build-env
WORKDIR /App

# Make sure we run bash
CMD ["bash"]

# Install all required build tools in a single layer (rarely changes — stays cached)
# Use nodejs24 for Node 24.x (required for ESM-compatible dependencies).
RUN --mount=type=cache,id=try-tdnf,target=/var/cache/tdnf,sharing=locked \
tdnf install -y gawk nodejs24 nodejs24-npm

# Copy only the files needed to restore dependencies.
# These layers are cached until a manifest file changes, so routine source edits
# don't re-run the expensive restore steps below.
Expand Down Expand Up @@ -38,9 +41,9 @@ RUN --mount=type=cache,id=try-nuget,target=/root/.nuget/packages \
# Copy all remaining source (changes frequently — only layers below rebuild on edits)
COPY . ./

# Build javascript library. The npm cache mount speeds up repeated local builds.
RUN --mount=type=cache,id=try-npm,target=/root/.npm \
/App/build-js.sh
# Bring built JS/CSS artifacts from the Node build stage.
COPY --from=node-build /App/src/Microsoft.TryDotNet/wwwroot/api /App/src/Microsoft.TryDotNet/wwwroot/api
COPY --from=node-build /App/src/Microsoft.TryDotNet/wwwroot/css /App/src/Microsoft.TryDotNet/wwwroot/css

# Publish only what we deploy
RUN --mount=type=cache,id=try-nuget,target=/root/.nuget/packages \
Expand Down