Skip to content

Commit 6a21a2c

Browse files
committed
chore: changed to support ARM
1 parent 8264d7a commit 6a21a2c

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
lines changed

.docfx/BuildDocfxImage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
$version = minver -i
22
docfx metadata docfx.json
3-
docker build -t sharedkernel-docfx:$version -f Dockerfile.docfx . # --progress plain
3+
docker buildx build -t sharedkernel-docfx:$version --platform linux/arm64,linux/amd64 --load -f Dockerfile.docfx . # --progress plain
44
get-childItem -recurse -path api -include *.yml, .manifest | remove-item

.docfx/Dockerfile.docfx

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
1-
# escape=`
2-
3-
FROM nginx:1.25.4 AS base
1+
FROM nginx:1.26.0-alpine AS base
42
RUN rm -rf /usr/share/nginx/html/*
53

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
811

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
1114

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
2518

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
2724

2825
WORKDIR /build
2926

3027
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
3629

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
4232

4333
FROM base AS final
4434
WORKDIR /usr/share/nginx/html

0 commit comments

Comments
 (0)