Merge pull request 'Simplified docker files' (#11) from setup into master
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
@@ -3,26 +3,15 @@ WORKDIR /app
|
|||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /app_source
|
||||||
|
|
||||||
# 1. Copy the master solution file and structural project footprints.
|
|
||||||
# Wildcard matching reads everything cleanly into the build cache layer.
|
|
||||||
COPY LiteCharmsSecurity.sln ./
|
|
||||||
COPY src/*/*.csproj ./
|
|
||||||
COPY src/ ./src/
|
|
||||||
# Clean up duplicate files dropped into the root context by the wildcard copy
|
|
||||||
RUN rm -f *.csproj
|
|
||||||
|
|
||||||
# 2. Restore the entire solution using the global solution profile
|
|
||||||
RUN dotnet restore "LiteCharmsSecurity.sln"
|
|
||||||
|
|
||||||
# 3. Bring in the rest of your implementation logic code files
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 4. Target your specific Admin API project path for Compilation & Publishing
|
RUN dotnet restore "LiteCharmsSecurity.sln"
|
||||||
WORKDIR "/src/src/LiteCharmsSecurity.Admin.Api"
|
|
||||||
|
WORKDIR "/app_source/src/LiteCharmsSecurity.Admin.Api"
|
||||||
RUN dotnet build "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build
|
RUN dotnet build "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
|
|||||||
@@ -5,34 +5,23 @@ EXPOSE 443
|
|||||||
|
|
||||||
FROM node:22-bookworm-slim AS node
|
FROM node:22-bookworm-slim AS node
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
|
||||||
NUGET_XMLDOC_MODE=skip
|
NUGET_XMLDOC_MODE=skip
|
||||||
WORKDIR /src
|
WORKDIR /app_source
|
||||||
|
|
||||||
# Bring over Node & NPM runtimes for administrative UI asset packaging steps
|
# Pull in the node runtimes for UI asset bundling
|
||||||
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
||||||
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
||||||
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||||
&& npm install -g npm@latest \
|
&& npm install -g npm@latest
|
||||||
&& node --version && npm --version
|
|
||||||
|
|
||||||
# 1. Copy the master solution file and project structures for build cache retention
|
|
||||||
COPY LiteCharmsSecurity.sln ./
|
|
||||||
COPY src/*/*.csproj ./
|
|
||||||
COPY src/ ./src/
|
|
||||||
# Clean up duplicate files dropped into the root context by the wildcard copy
|
|
||||||
RUN rm -f *.csproj
|
|
||||||
|
|
||||||
# 2. Restore the entire solution cleanly via public NuGet paths
|
|
||||||
RUN dotnet restore "LiteCharmsSecurity.sln"
|
|
||||||
|
|
||||||
# 3. Pull in the remaining implementation files
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 4. Navigate into your specific Admin UI directory context for assembly compilation
|
RUN dotnet restore "LiteCharmsSecurity.sln"
|
||||||
WORKDIR "/src/src/LiteCharmsSecurity.Admin"
|
|
||||||
|
WORKDIR "/app_source/src/LiteCharmsSecurity.Admin"
|
||||||
RUN dotnet build "LiteCharmsSecurity.Admin.csproj" -c Release -o /app/build
|
RUN dotnet build "LiteCharmsSecurity.Admin.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
|
|||||||
@@ -1,28 +1,20 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /app_source
|
||||||
|
|
||||||
# 1. Copy the master solution file and the entire project directory structures
|
# Copy everything from repository root into /app_source
|
||||||
# but ONLY copy the .csproj files. This keeps the Docker layer cache completely optimization-friendly.
|
|
||||||
COPY LiteCharmsSecurity.sln ./
|
|
||||||
COPY src/*/*.csproj ./
|
|
||||||
COPY src/ ./src/
|
|
||||||
# Clean up duplicate files dropped into the root context by the wildcard copy
|
|
||||||
RUN rm -f *.csproj
|
|
||||||
|
|
||||||
# 2. Restore the entire solution cleanly using the global workspace cache
|
|
||||||
RUN dotnet restore "LiteCharmsSecurity.sln"
|
|
||||||
|
|
||||||
# 3. Bring in the rest of your implementation code files now that the packages are fully cached
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# 4. Target your specific project execution path for Compilation & Publishing
|
# Restore the solution from the root context
|
||||||
WORKDIR "/src/src/LiteCharmsSecurity.STS.Identity"
|
RUN dotnet restore "LiteCharmsSecurity.sln"
|
||||||
|
|
||||||
|
# Paths match your repository exactly now: src/ is just under the root
|
||||||
|
WORKDIR "/app_source/src/LiteCharmsSecurity.STS.Identity"
|
||||||
RUN dotnet build "LiteCharmsSecurity.STS.Identity.csproj" -c Release -o /app/build
|
RUN dotnet build "LiteCharmsSecurity.STS.Identity.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
|
|||||||
Reference in New Issue
Block a user