-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCA
57 lines (54 loc) · 1.98 KB
/
CA
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
diff --git a/cli/command/command.go b/cli/command/command.go
index 0844461..231c832 100644
--- a/cli/command/command.go
+++ b/cli/command/command.go
@@ -21,6 +21,12 @@ func BuildCommand(factory app.ProjectFactory) cli.Command {
Name: "build",
Usage: "Build or rebuild services.",
Action: app.WithProject(factory, app.ProjectBuild),
+ Flags: []cli.Flag{
+ cli.BoolFlag{
+ Name: "no-cache",
+ Usage: "Do not use cache when building the image",
+ },
+ },
}
}
@@ -221,5 +227,7 @@ func Populate(context *project.Context, c *cli.Context) {
context.Timeout = c.Int("timeout")
} else if c.Command.Name == "kill" {
context.Signal = c.String("signal")
- }
+ } else if c.Command.Name == "build" {
+ context.NoCache= c.Bool("no-cache")
+ }
}
diff --git a/docker/builder.go b/docker/builder.go
index f64a8df..5291655 100644
--- a/docker/builder.go
+++ b/docker/builder.go
@@ -47,13 +47,18 @@ func (d *DaemonBuilder) Build(p *project.Project, service project.Service) (stri
defer context.Close()
client := d.context.ClientFactory.Create(service)
-
+ if d.context.NoCache {
+ logrus.Infof("nocache=true")
+ } else {
+ logrus.Infof("nocache=false")
+ }
logrus.Infof("Building %s...", tag)
output, err := client.BuildImage(&dockerclient.BuildImage{
Context: context,
RepoName: tag,
Remove: true,
DockerfileName: service.Config().Dockerfile,
+ NoCache: d.context.NoCache,
diff --git a/project/context.go b/project/context.go
index 06c0a09..e6253c9 100644
--- a/project/context.go
+++ b/project/context.go
@@ -18,6 +18,7 @@ var projectRegexp = regexp.MustCompile("[^a-zA-Z0-9_.-]")
type Context struct {
Timeout int
Log bool
+ NoCache bool