Skip to content

Commit 1469d72

Browse files
author
Jake Ginnivan
committed
Added ubuntu based docker image build to deployment
1 parent eb01f07 commit 1469d72

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM gittools/libgit2sharp-mono
2+
3+
MAINTAINER GitTools Maintainers <[email protected]>
4+
ARG GitVersionZip
5+
6+
# Add GitVersion
7+
8+
ADD ./releaseArtifacts/$GitVersionZip .
9+
RUN apt-get install unzip
10+
RUN unzip -d /usr/lib/GitVersion/ $GitVersionZip
11+
RUN rm $GitVersionZip
12+
WORKDIR /usr/lib/GitVersion/
13+
14+
# Libgit2 can't resolve relative paths, patch to absolute path
15+
RUN sed -i 's|lib/linux/x86_64|/usr/lib/GitVersion/lib/linux/x86_64|g' /usr/lib/GitVersion/LibGit2Sharp.dll.config
16+
17+
RUN mkdir /repo
18+
VOLUME /repo
19+
20+
ENTRYPOINT ["mono", "./GitVersion.exe", "/repo"]

deploy.cake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Task("DownloadGitHubReleaseArtifacts")
7171
if (!artifactLookup.ContainsKey("NuGetExeBuild")) { throw new Exception("NuGetExeBuild artifact missing"); }
7272
if (!artifactLookup.ContainsKey("GemBuild")) { throw new Exception("GemBuild artifact missing"); }
7373
if (!artifactLookup.ContainsKey("GitVersionTfsTaskBuild")) { throw new Exception("GitVersionTfsTaskBuild artifact missing"); }
74+
if (!artifactLookup.ContainsKey("zip")) { throw new Exception("zip artifact missing"); }
7475
});
7576

7677
Task("Publish-NuGetPackage")
@@ -174,13 +175,30 @@ Task("Publish-VstsTask")
174175
}
175176
});
176177

178+
179+
Task("Publish-DockerImage")
180+
.IsDependentOn("DownloadGitHubReleaseArtifacts")
181+
.Does(() =>
182+
{
183+
var returnCode = StartProcess("docker", new ProcessSettings
184+
{
185+
Arguments = "docker build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag latest --tag " + tag
186+
});
187+
188+
if (returnCode != 0) {
189+
Information("Publish-DockerImage Task failed, but continuing with next Task...");
190+
publishingError = true;
191+
}
192+
});
193+
177194
Task("Deploy")
178195
.IsDependentOn("Publish-NuGetPackage")
179196
.IsDependentOn("Publish-NuGetCommandLine")
180197
.IsDependentOn("Publish-MsBuildTask")
181198
.IsDependentOn("Publish-Chocolatey")
182199
// .IsDependentOn("Publish-Gem")
183200
.IsDependentOn("Publish-VstsTask")
201+
.IsDependentOn("Publish-DockerImage")
184202
.Finally(() =>
185203
{
186204
if(publishingError)

src/DockerBase/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ubuntu:16.04
2+
3+
MAINTAINER GitTools Maintainers <[email protected]>
4+
5+
# Wheezy doesn't support glibc 2.15 which libgit2sharp requires
6+
# So we are going to install mono on ubuntu instead
7+
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
8+
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list
9+
RUN apt-get update
10+
RUN apt-get install mono-complete libcurl3 tzdata unzip curl -y
11+
RUN cp /usr/share/zoneinfo/GMT /etc/localtime

src/DockerBase/readme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Docker Base
2+
We need a custom docker base image because mono is too old to support libgit2sharp
3+
4+
## To build/publish
5+
docker build . --tag gittools/libgit2sharp-mono
6+
docker push gittools/libgit2sharp-mono

0 commit comments

Comments
 (0)