-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker.cake
71 lines (56 loc) · 1.68 KB
/
docker.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#addin nuget:?package=Cake.Docker&version=0.11.0
var target = Argument("target", "Default");
var tag = Argument("tag", "latest");
var image = Argument("image", "camera-bot");
var registry = Argument("registry", "andeadlier");
// General
Task("Default")
.IsDependentOn("Build");
// Build
var dockerComposeBuildSettings = new DockerComposeBuildSettings
{
ProjectDirectory = "./src"
};
Task("Build")
.IsDependentOn("BuildAmd64")
.IsDependentOn("BuildArm32");
Task("BuildAmd64")
.Does(() =>
{
var settings = new DockerComposeBuildSettings
{
Files = new [] {"./src/docker-compose.yml"}
};
DockerComposeBuild(settings);
});
Task("BuildArm32")
.Does(() =>
{
var settings = new DockerComposeBuildSettings
{
Files = new [] {"./src/docker-compose.arm32.yml"}
};
DockerComposeBuild(settings);
});
// Tag
string amd64ImageReference = $"{image}:{tag}";
string amd64RegistryReference = $"{registry}/{image}:{tag}";
string arm32ImageReference = $"{image}:{tag}-arm32v7";
string arm32RegistryReference = $"{registry}/{image}:{tag}-arm32v7";
Task("TagAmd64")
.IsDependentOn("BuildAmd64")
.Does(() => DockerTag(amd64ImageReference, amd64RegistryReference));
Task("TagArm32")
.IsDependentOn("BuildArm32")
.Does(() => DockerTag(arm32ImageReference, arm32RegistryReference));
// Push
Task("Push")
.IsDependentOn("PushAmd64")
.IsDependentOn("PushArm32");
Task("PushAmd64")
.IsDependentOn("TagAmd64")
.Does(() => DockerPush(amd64RegistryReference));
Task("PushArm32")
.IsDependentOn("TagArm32")
.Does(() => DockerPush(arm32RegistryReference));
RunTarget(target);