Browse Source

Use NLog built for docker

Nick Babcock 7 years ago
parent
commit
6d5b7afc2d
2 changed files with 18 additions and 1 deletions
  1. 4 1
      Dockerfile
  2. 14 0
      OhmGraphite/NLog.docker.config

+ 4 - 1
Dockerfile

@@ -1,9 +1,12 @@
 FROM mono:5.4.0.201 as builder
 COPY . /tmp/
 WORKDIR /tmp
-RUN msbuild /t:restore /t:build /p:Configuration=Release
+RUN msbuild /t:restore /t:build /p:Configuration=Release && \
+    rm /tmp/OhmGraphite/bin/Release/net46/OhmGraphite.exe.config
 
 FROM mono:5.4.0.201
 COPY --from=builder /tmp/OhmGraphite/bin/Release/net46 /opt/OhmGraphite
+COPY --from=builder /tmp/OhmGraphite/NLog.docker.config /opt/OhmGraphite/NLog.config
 WORKDIR /opt/OhmGraphite
+VOLUME /opt/OhmGraphite/OhmGraphite.exe.config
 CMD mono OhmGraphite.exe

+ 14 - 0
OhmGraphite/NLog.docker.config

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <targets>
+    <target name="console"
+            xsi:type="Console"
+            layout="${longdate}|${level:uppercase=true}|${logger}|${message:exceptionSeparator=!:withException=true}"/>
+  </targets>
+
+  <rules>
+    <logger name="*" minlevel="Info" writeTo="console" />
+  </rules>
+</nlog>