38 lines
1.3 KiB
Docker
38 lines
1.3 KiB
Docker
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
|
ARG TELERIK_LICENSE
|
|
ARG TELERIK_USERNAME
|
|
ARG TELERIK_PASSWORD
|
|
ENV TELERIK_LICENSE=$TELERIK_LICENSE
|
|
ENV TELERIK_USERNAME=$TELERIK_USERNAME
|
|
ENV TELERIK_PASSWORD=$TELERIK_PASSWORD
|
|
WORKDIR /src
|
|
|
|
# Copy the entire parent directory into the build context
|
|
# We expect Chrono and chrono.docs to be siblings
|
|
COPY Chrono/ Chrono/
|
|
COPY chrono.docs/ chrono.docs/
|
|
|
|
WORKDIR /src/Chrono
|
|
# Ensure Telerik credentials are set and not placeholders
|
|
RUN if [ -z "$TELERIK_USERNAME" ] || [ "$TELERIK_USERNAME" = "your_telerik_username_or_api-key" ]; then \
|
|
echo "ERROR: TELERIK_USERNAME is not set in the build environment."; \
|
|
exit 1; \
|
|
fi
|
|
|
|
# Inject credentials into nuget.config to ensure they are available for restore
|
|
RUN dotnet nuget update source TelerikServer \
|
|
--username "$TELERIK_USERNAME" \
|
|
--password "$TELERIK_PASSWORD" \
|
|
--store-password-in-clear-text \
|
|
--configfile nuget.config
|
|
|
|
RUN dotnet restore "Chrono.sln" --configfile nuget.config
|
|
RUN dotnet publish "Server/Server.csproj" -c Release -o /app/publish /p:TelerikLicense="$TELERIK_LICENSE"
|
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
|
|
WORKDIR /app
|
|
COPY --from=build /app/publish .
|
|
EXPOSE 8080
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
ENTRYPOINT ["dotnet", "Server.dll"]
|