|
1 |
| -# escape=` |
2 |
| - |
3 |
| -FROM nginx:1.25.4 AS base |
| 1 | +FROM nginx:1.26.0-alpine AS base |
4 | 2 | RUN rm -rf /usr/share/nginx/html/*
|
5 | 3 |
|
6 |
| -FROM mono:6.12.0.182 AS build |
7 |
| -ARG DOCFX_VERSION=v2.75.3 |
| 4 | +FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build |
| 5 | + |
| 6 | +ENV DOTNET_ROOT=/root/.dotnet |
| 7 | +ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools |
| 8 | + |
| 9 | +RUN apt update \ |
| 10 | + && apt install git |
8 | 11 |
|
9 |
| -ENV PATH ${PATH}:/opt/docfx |
10 |
| -ENV DOCFX_SOURCE_BRANCH_NAME="main" |
| 12 | +RUN git clone https://github.com/dotnet/docfx.git \ |
| 13 | + && mkdir -p /opt/docfx |
11 | 14 |
|
12 |
| -# MONO IMAGE |
13 |
| -RUN curl -sSL --output packages-microsoft-prod.deb https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb |
14 |
| -RUN dpkg -i packages-microsoft-prod.deb |
15 |
| -RUN apt-get update ` |
16 |
| -&& apt-get install -y powershell zip apt-transport-https dirmngr gnupg ca-certificates git ` |
17 |
| -&& mkdir -p /opt/docfx/ ` |
18 |
| -&& curl -sSL --output docfx.zip "https://github.com/dotnet/docfx/releases/download/${DOCFX_VERSION}/docfx-linux-x64-${DOCFX_VERSION}.zip" ` |
19 |
| -&& unzip docfx.zip -d /opt/docfx/ ` |
20 |
| -&& rm docfx.zip ` |
21 |
| -&& echo '#!/bin/bash' >> /opt/docfx/docfx ` |
22 |
| -&& echo 'exec mono /opt/docfx/docfx.exe $@' >> /opt/docfx/docfx ` |
23 |
| -&& chmod +x /opt/docfx/docfx ` |
24 |
| -&& apt-get -y purge unzip |
| 15 | +RUN cd docfx \ |
| 16 | + && cp -r --parents templates/default /opt/docfx \ |
| 17 | + && cp -r --parents templates/modern /opt/docfx |
25 | 18 |
|
26 |
| -SHELL ["/opt/microsoft/powershell/7/pwsh", "-Command"] |
| 19 | +RUN curl -sSL --output dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ |
| 20 | + && chmod +x ./dotnet-install.sh \ |
| 21 | + && ./dotnet-install.sh --runtime aspnetcore --channel 8.0 |
| 22 | + |
| 23 | +RUN dotnet tool install --global docfx --version 2.75.3 |
27 | 24 |
|
28 | 25 | WORKDIR /build
|
29 | 26 |
|
30 | 27 | ADD [".", "docfx"]
|
31 |
| -#ADD ["src", "src"] INCLUDE THIS WHEN DOCFX IS MATURED - SEE NOTE BELOW |
32 |
| - |
33 |
| -RUN cd docfx; ` |
34 |
| -# docfx metadata; ` INCLUDE THIS WHEN DOCFX IS MATURED - SEE NOTE BELOW |
35 |
| -docfx build |
| 28 | +RUN cp -r /opt/docfx/templates /build/docfx/templates |
36 | 29 |
|
37 |
| -# After carefull considerations, I have concluded that DoxFx is not a matured product to be run entirely as part of a Docker image. |
38 |
| -# Reason is that for DocFx to resolve cref correctly (and assembly names) it requires the msbuild project file (csproj) and not only the source files (cs). |
39 |
| -# As stated by docfx team themself: Visual Studio 2019 is needed for docfx metadata msbuild projects. |
40 |
| -# Given that VS2019 is to hard a dependency, I have moved the docfx metadata taskto my local development environment. |
41 |
| -# It would have been great to have all documentation done in a container - but for now this is not an option without significant drawbacks. |
| 30 | +RUN cd docfx; \ |
| 31 | + docfx build |
42 | 32 |
|
43 | 33 | FROM base AS final
|
44 | 34 | WORKDIR /usr/share/nginx/html
|
|
0 commit comments