Skip to content

Commit

Permalink
Dockerfile, docs and tidy-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Laffey authored and MaxMelcher committed Feb 24, 2022
1 parent 47a7b0c commit b26925d
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 15 deletions.
2 changes: 1 addition & 1 deletion AzureDevOps.WikiPDFExport/ExportedWikiDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ public string basePath()
}
public DirectoryInfo attachments { get; }
}
}
}
13 changes: 1 addition & 12 deletions AzureDevOps.WikiPDFExport/WikiPDFExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -949,17 +949,6 @@ async private Task<string> generateWorkItemLink(string stringId, WorkItemTrackin
</span>
";
}

private String FindBaseOfWikiFromChildPath(String exportBase){
var directory = new DirectoryInfo(Path.GetFullPath(exportBase));
DirectoryInfo[] gitDirs = directory.GetDirectories("./.git");
if (gitDirs == null || gitDirs.Length == 0) {

}
Log($"Reading .order file in directory {exportBase}");
var orderFiles = directory.GetFiles(".order", SearchOption.TopDirectoryOnly);
return Path.GetFullPath("ds");
}
}

public class MarkdownFile
Expand All @@ -974,4 +963,4 @@ public override string ToString()
return $"[{Level}] {AbsolutePath}";
}
}
}
}
2 changes: 1 addition & 1 deletion AzureDevOps.WikiPDFExport/WikiPdfExportException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ public WikiPdfExportException(string message, System.Exception inner) : base(mes
protected WikiPdfExportException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
}
8 changes: 8 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ dotnet build
This will build a debug version to the `bin` folder of the project. The output
will be in the `bin\Debug\net6.0` folder by default.

### Release Build

To generate an executable similar to the official release, see the github
work-flows YAML. It has the correct commands for the different platforms. For
example:

`dotnet publish -r linux-x64 -c Release -p:Version=99.99.999 --no-self-contained -o output/linux-x64`

## Testing

~~~terminal
Expand Down
82 changes: 82 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
####################################################
# Azure Devops PDF Exporter Image
# DEV GUIDELINES ###################################
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices
#####################################################

FROM ubuntu:18.04

# Versions of custom installed tools
# Versions of items installed via NPM or APT are in the command lines below.
ENV TZ=Europe/Dublin \
ANSIBLE_VERSION=2.10.4 \
KUBECTL_VERSION=1.19.2 \
HELM_VERSION=3.3.4 \
AWS_CLI_VERSION=2.1.15 \
YQ_VERSION=3.3.2 \
FLYWAY_VERSION=7.0.0 \
PIP_VERSION=20.3.3 \
POWERSHELL_VERSION=7.1*

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq -o=Dpkg::Use-Pty=0 update --fix-missing && apt-get -qq -o=Dpkg::Use-Pty=0 install -f -y gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2\
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
fonts-liberation \
libappindicator1 \
libnss3 \
lsb-release \
xdg-utils \
wget \
libgbm-dev \
ttf-ancient-fonts\
# Tidy up
&& apt-get -qq autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN export DEBIAN_FRONTEND=noninteractive \
# Install Microsoft package feed
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
\
# Install .NET
&& apt-get update \
&& apt-get install -y apt-transport-https \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
dotnet-runtime-6.0 \
\
# Cleanup
&& rm -rf /var/lib/apt/lists/*

COPY ./output/linux-x64/azuredevops-export-wiki /usr/local/bin
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The tool currently supports the following:

## 🛰 Requirements

The tool is developed as .NET 5 application, therefore you need to have the runtime installed.
The tool is developed as .NET 6 application, therefore you need to have the runtime installed.
Download is available [here](https://dotnet.microsoft.com/download).
It requires a x64 **windows** or **linux** runtime.

Expand Down Expand Up @@ -99,6 +99,24 @@ Path to a single markdown file to convert to PDF. If you want to write your chan
### -v / --verbose
Verbose mode. Logging will added to the console window

## Running in Docker

To build the Docker Image run the following commands (replace `<VERSION>`):

~~~powershell
dotnet publish -r linux-x64 -c Release -p:Version=<VERSION> --no-self-contained -o output/linux-x64
docker build --pull --rm -f "Dockerfile" -t azdowiki-pdf-export:latest "."
~~~

Launch a container:

~~~powershell
docker run -it -v ${pwd}:/usr/root/wiki -w /usr/root/wiki azdowiki-pdf-export:latest bash
~~~

Change the volume mapping (`-v ${pwd}`) to the location of your wiki and then
run `azuredevops-export-wiki -p .` to generate your PDF.

## 😲 Limitations

So far the following limitations are known:
Expand Down

0 comments on commit b26925d

Please sign in to comment.