Skip to content

Commit

Permalink
support -f flag
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang committed Aug 1, 2019
1 parent 428a812 commit da61f1c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dotamfile.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var "versions" {
prod = "v0.1.1"
release = "v0.1.44-beta"
release = "v0.1.45-beta"
}

temp "version.go" {
Expand Down
7 changes: 5 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
- [ ] ! 自举
- [ ] ! git 插件
- [ ] git hook
- [ ] ! docker 插件
- [ ] !! docker 插件
- [x] !! build
- [x] !! push
- [x] pass auth from command line
- [x] ! pass auth from command line
- [ ] !! support multi tags for pushing
- [x] !! support specifying Dockerfile

- [ ] ! refactor code
- [ ] !! caporal
- [x] 创建容器
Expand Down
9 changes: 5 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ type Temp struct {
}

type Docker struct {
Repo string `json:"repo" hcl:"repo" yaml:"repo"`
Tag string `json:"tag" hcl:"tag" yaml:"tag"`
Auth Auth `json:"auth" hcl:"auth" yaml:"auth"`
Caporal Caporal `json:"caporal" hcl:"caporal" yaml:"caporal"`
Repo string `json:"repo" hcl:"repo" yaml:"repo"`
Tag string `json:"tag" hcl:"tag" yaml:"tag"`
Dockerfile string `json:"dockerfile,omitempty" hcl:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
Auth Auth `json:"auth" hcl:"auth" yaml:"auth"`
Caporal Caporal `json:"caporal" hcl:"caporal" yaml:"caporal"`
}

// Caporal is a built-in plugin for scheduling containers remotely
Expand Down
8 changes: 7 additions & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ func ParseBuildArgs(src []string) (dotamFile string, dest []string) {

func BuildImage(d Docker, c *docker.Client) (err error) {

dockerfile := ""
if len(d.Dockerfile) != 0 {
dockerfile = d.Dockerfile
} else {
dockerfile = "Dockerfile"
}
log.WithFields(log.Fields{"PROCESS": "DOCKER REPO"}).Debug(d.Repo)
log.WithFields(log.Fields{"PROCESS": "DOCKER TAG"}).Debug(d.Tag)
log.WithFields(log.Fields{"PROCESS": "DOCKER AUTH"}).Debug(d.Auth)
Expand All @@ -191,7 +197,7 @@ func BuildImage(d Docker, c *docker.Client) (err error) {
if err = c.BuildImage(docker.BuildImageOptions{
Name: imageName,
ContextDir: ".",
Dockerfile: "Dockerfile",
Dockerfile: dockerfile,
SuppressOutput: false,
OutputStream: os.Stdout,
RmTmpContainer: true,
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

var RELEASE_VERSION = "v0.1.44-beta"
var RELEASE_VERSION = "v0.1.45-beta"

0 comments on commit da61f1c

Please sign in to comment.