Files
using.cash/Dockerfile
Dolon 6d87722cc8
CI / docker (push) Has been cancelled
CI / build-and-test (push) Has been cancelled
ci: ignore failed cache source when falling back to nuget.org
2026-04-10 08:14:21 +00:00

39 lines
1.6 KiB
Docker

FROM node:20-slim AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
ARG NPM_REGISTRY_URL
RUN if [ -n "$NPM_REGISTRY_URL" ]; then npm config set registry "$NPM_REGISTRY_URL"; fi \
&& npm ci
COPY frontend/ ./
RUN npm run build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS backend-build
WORKDIR /app
COPY src/*.sln src/
COPY src/UsingCash.Common/*.csproj src/UsingCash.Common/
COPY src/UsingCash.Basic/*.csproj src/UsingCash.Basic/
COPY src/UsingCash.Database/*.csproj src/UsingCash.Database/
COPY src/UsingCash.Logic/*.csproj src/UsingCash.Logic/
COPY src/UsingCash.Api/*.csproj src/UsingCash.Api/
COPY src/UsingCash.Backend/*.csproj src/UsingCash.Backend/
COPY src/UsingCash.Migration/*.csproj src/UsingCash.Migration/
COPY src/UsingCash.Tests/*.csproj src/UsingCash.Tests/
ARG NUGET_CACHE_URL
RUN if [ -n "$NUGET_CACHE_URL" ]; then \
dotnet restore src/UsingCash.sln --source "$NUGET_CACHE_URL" --source "https://api.nuget.org/v3/index.json" --ignore-failed-sources; \
else \
dotnet restore src/UsingCash.sln; \
fi
COPY src/ src/
COPY --from=frontend-build /app/src/UsingCash.Api/wwwroot src/UsingCash.Api/wwwroot/
RUN dotnet publish src/UsingCash.Api/UsingCash.Api.csproj -c Release -o /app/publish --no-restore
RUN dotnet publish src/UsingCash.Migration/UsingCash.Migration.csproj -c Release -o /app/migration --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=backend-build /app/publish .
COPY --from=backend-build /app/migration /app/migration/
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "UsingCash.Api.dll"]