File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ var dockerListCmd = &cobra.Command{
24
24
},
25
25
}
26
26
27
+ var dockerBuildCmd = & cobra.Command {
28
+ Use : "build" ,
29
+ Short : "build a docker container"
30
+ Long : "build a docker container for use with ingress-nginx"
31
+ Run : func (cmd * cobra.Command , args []string ){
32
+ dockerBuild ()
33
+ },
34
+
35
+ }
27
36
func init () {
28
37
rootCmd .AddCommand (dockerCmd )
29
38
dockerCmd .AddCommand (dockerListCmd )
@@ -44,3 +53,36 @@ func dockerList() {
44
53
fmt .Printf ("%s %s\n " , container .ID [:10 ], container .Image )
45
54
}
46
55
}
56
+
57
+ func dockerBuild () error {
58
+ /*
59
+ docker build \
60
+ ${PLATFORM_FLAG} ${PLATFORM} \
61
+ --no-cache \
62
+ --pull \
63
+ --build-arg BASE_IMAGE="$(BASE_IMAGE)" \
64
+ --build-arg VERSION="$(TAG)" \
65
+ --build-arg TARGETARCH="$(ARCH)" \
66
+ --build-arg COMMIT_SHA="$(COMMIT_SHA)" \
67
+ --build-arg BUILD_ID="$(BUILD_ID)" \
68
+ -t $(REGISTRY)/controller:$(TAG) rootfs
69
+ */
70
+
71
+ cli , err := client .NewClientWithOpts (client .FromEnv )
72
+ if err != nil {
73
+ panic (err )
74
+ }
75
+
76
+ builder := io.Reader {}
77
+
78
+ options := docker.ImageCreateOptions {
79
+
80
+
81
+ }
82
+ buildReponse , err := cli .ImageBuild (context .Background (), builder , options )
83
+ if err != nil {
84
+ return err
85
+ }
86
+ return nil
87
+
88
+ }
You can’t perform that action at this time.
0 commit comments