-
Notifications
You must be signed in to change notification settings - Fork 655
Feature/docker #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/docker #1215
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM gittools/libgit2sharp-mono | ||
|
||
MAINTAINER GitTools Maintainers <[email protected]> | ||
ARG GitVersionZip | ||
|
||
# Add GitVersion | ||
|
||
ADD ./releaseArtifacts/$GitVersionZip . | ||
RUN unzip -d /usr/lib/GitVersion/ $GitVersionZip | ||
RUN rm $GitVersionZip | ||
WORKDIR /usr/lib/GitVersion/ | ||
|
||
# Libgit2 can't resolve relative paths, patch to absolute path | ||
RUN sed -i 's|lib/linux/x86_64|/usr/lib/GitVersion/lib/linux/x86_64|g' /usr/lib/GitVersion/LibGit2Sharp.dll.config | ||
|
||
RUN mkdir /repo | ||
VOLUME /repo | ||
|
||
ENTRYPOINT ["mono", "./GitVersion.exe", "/repo"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ Task("DownloadGitHubReleaseArtifacts") | |
if (!artifactLookup.ContainsKey("NuGetExeBuild")) { throw new Exception("NuGetExeBuild artifact missing"); } | ||
if (!artifactLookup.ContainsKey("GemBuild")) { throw new Exception("GemBuild artifact missing"); } | ||
if (!artifactLookup.ContainsKey("GitVersionTfsTaskBuild")) { throw new Exception("GitVersionTfsTaskBuild artifact missing"); } | ||
if (!artifactLookup.ContainsKey("zip")) { throw new Exception("zip artifact missing"); } | ||
}); | ||
|
||
Task("Publish-NuGetPackage") | ||
|
@@ -174,13 +175,59 @@ Task("Publish-VstsTask") | |
} | ||
}); | ||
|
||
|
||
Task("Publish-DockerImage") | ||
.IsDependentOn("DownloadGitHubReleaseArtifacts") | ||
.Does(() => | ||
{ | ||
var returnCode = StartProcess("docker", new ProcessSettings | ||
{ | ||
Arguments = "build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag gittools/gitversion" | ||
}); | ||
if (returnCode != 0) { | ||
Information("Publish-DockerImage Task failed to build image, but continuing with next Task..."); | ||
publishingError = true; | ||
} | ||
|
||
// Login to dockerhub | ||
returnCode = StartProcess("docker", new ProcessSettings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for not using the Cake.Docker addin for this? |
||
{ | ||
Arguments = "login -u=\"" + EnvironmentVariable("DOCKER_USERNAME") +"\" -p=\"" + EnvironmentVariable("DOCKER_PASSWORD") +"\"" | ||
}); | ||
if (returnCode != 0) { | ||
Information("Publish-DockerImage Task failed to login, but continuing with next Task..."); | ||
publishingError = true; | ||
} | ||
|
||
// Publish Tag | ||
returnCode = StartProcess("docker", new ProcessSettings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for not using the Cake.Docker addin for this? |
||
{ | ||
Arguments = "push gittools/gitversion:" + tag | ||
}); | ||
if (returnCode != 0) { | ||
Information("Publish-DockerImage Task failed push version tag, but continuing with next Task..."); | ||
publishingError = true; | ||
} | ||
|
||
// Publish latest | ||
returnCode = StartProcess("docker", new ProcessSettings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for not using the Cake.Docker addin for this? |
||
{ | ||
Arguments = "push gittools/gitversion:latest" | ||
}); | ||
if (returnCode != 0) { | ||
Information("Publish-DockerImage Task failed latest tag, but continuing with next Task..."); | ||
publishingError = true; | ||
} | ||
}); | ||
|
||
Task("Deploy") | ||
.IsDependentOn("Publish-NuGetPackage") | ||
.IsDependentOn("Publish-NuGetCommandLine") | ||
.IsDependentOn("Publish-MsBuildTask") | ||
.IsDependentOn("Publish-Chocolatey") | ||
// .IsDependentOn("Publish-Gem") | ||
.IsDependentOn("Publish-VstsTask") | ||
.IsDependentOn("Publish-DockerImage") | ||
.Finally(() => | ||
{ | ||
if(publishingError) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM ubuntu | ||
|
||
MAINTAINER GitTools Maintainers <[email protected]> | ||
|
||
# Wheezy doesn't support glibc 2.15 which libgit2sharp requires | ||
# So we are going to install mono on ubuntu instead | ||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | ||
RUN apt-get update | ||
RUN apt-get install libcurl3 tzdata unzip curl git-all -y | ||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list | ||
RUN apt-get update | ||
RUN apt-get install mono-complete -y | ||
RUN cp /usr/share/zoneinfo/GMT /etc/localtime |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Docker Base | ||
We need a custom docker base image because mono is too old to support libgit2sharp | ||
|
||
## To build/publish | ||
docker build . --tag gittools/libgit2sharp-mono | ||
docker push gittools/libgit2sharp-mono |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for not using the Cake.Docker addin for this?
https://github.com/MihaMarkic/Cake.Docker