Skip to content

Commit 23d8361

Browse files
author
Jake Ginnivan
committed
Updated deploy to build and deploy to docker hub
1 parent 1469d72 commit 23d8361

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ARG GitVersionZip
66
# Add GitVersion
77

88
ADD ./releaseArtifacts/$GitVersionZip .
9-
RUN apt-get install unzip
109
RUN unzip -d /usr/lib/GitVersion/ $GitVersionZip
1110
RUN rm $GitVersionZip
1211
WORKDIR /usr/lib/GitVersion/

deploy.cake

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,40 @@ Task("Publish-DockerImage")
182182
{
183183
var returnCode = StartProcess("docker", new ProcessSettings
184184
{
185-
Arguments = "docker build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag latest --tag " + tag
185+
Arguments = "build . --build-arg GitVersionZip=" + artifactLookup["zip"] + " --tag gittools/gitversion"
186186
});
187+
if (returnCode != 0) {
188+
Information("Publish-DockerImage Task failed to build image, but continuing with next Task...");
189+
publishingError = true;
190+
}
191+
192+
// Login to dockerhub
193+
returnCode = StartProcess("docker", new ProcessSettings
194+
{
195+
Arguments = "login -u=\"" + EnvironmentVariable("DOCKER_USERNAME") +"\" -p=\"" + EnvironmentVariable("DOCKER_PASSWORD") +"\""
196+
});
197+
if (returnCode != 0) {
198+
Information("Publish-DockerImage Task failed to login, but continuing with next Task...");
199+
publishingError = true;
200+
}
187201

202+
// Publish Tag
203+
returnCode = StartProcess("docker", new ProcessSettings
204+
{
205+
Arguments = "push gittools/gitversion:" + tag
206+
});
207+
if (returnCode != 0) {
208+
Information("Publish-DockerImage Task failed push version tag, but continuing with next Task...");
209+
publishingError = true;
210+
}
211+
212+
// Publish latest
213+
returnCode = StartProcess("docker", new ProcessSettings
214+
{
215+
Arguments = "push gittools/gitversion:latest"
216+
});
188217
if (returnCode != 0) {
189-
Information("Publish-DockerImage Task failed, but continuing with next Task...");
218+
Information("Publish-DockerImage Task failed latest tag, but continuing with next Task...");
190219
publishingError = true;
191220
}
192221
});

src/DockerBase/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ MAINTAINER GitTools Maintainers <[email protected]>
77
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
88
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list
99
RUN apt-get update
10-
RUN apt-get install mono-complete libcurl3 tzdata unzip curl -y
10+
RUN apt-get install mono-complete libcurl3 tzdata unzip curl git-all -y
1111
RUN cp /usr/share/zoneinfo/GMT /etc/localtime

0 commit comments

Comments
 (0)