diff --git a/docker/docker-darwin.go b/docker/docker-darwin.go index 46a8424..0ef869e 100644 --- a/docker/docker-darwin.go +++ b/docker/docker-darwin.go @@ -2,19 +2,6 @@ package docker -import ( - "fmt" - "strings" -) - -func (r *Runner) checkProjectDir() error { - if !strings.HasPrefix(r.projectDir, "/Users/") { - return fmt.Errorf("The project path must be prefixed with /Users/ on Mac OS") - } - - return nil -} - func (r *Runner) canonicalProjectDir() string { return r.projectDir } diff --git a/docker/docker-linux.go b/docker/docker-linux.go index bf5f059..e818aa2 100644 --- a/docker/docker-linux.go +++ b/docker/docker-linux.go @@ -8,10 +8,6 @@ const ( dockerSockPath = "/var/run/docker.sock" ) -func (r *Runner) checkProjectDir() error { - return nil -} - func (r *Runner) canonicalProjectDir() string { return r.projectDir } diff --git a/docker/docker-windows.go b/docker/docker-windows.go index def6d39..62cdbd5 100644 --- a/docker/docker-windows.go +++ b/docker/docker-windows.go @@ -14,14 +14,6 @@ func parseWindowsPath(path string) string { return fmt.Sprintf("/%v%v", strings.ToLower(subPaths[0]), subPaths[1]) } -func (r *Runner) checkProjectDir() error { - if !strings.HasPrefix(r.projectDir, "C:\\Users\\") { - return fmt.Errorf("The project path must be prefixed with C:\\Users\\ on Windows") - } - - return nil -} - func (r *Runner) canonicalProjectDir() string { return parseWindowsPath(r.projectDir) } diff --git a/docker/docker.go b/docker/docker.go index 5315e13..834cd5e 100644 --- a/docker/docker.go +++ b/docker/docker.go @@ -23,8 +23,6 @@ import ( const ( // ExecDriverName is name of exec-driver ExecDriverName = "docker" - // DefaultSrcVolume is the default source path inside the container - DefaultSrcVolume = "/src" // SettingName is the name of section of settings SettingName = "docker" // Dockerfile is default name of Dockerfile @@ -362,12 +360,7 @@ func (r *Runner) push(sigCh <-chan os.Signal) error { return nil } -func (r *Runner) run(sigCh <-chan os.Signal) error { - err := r.checkProjectDir() - if err != nil { - return err - } - +func (r *Runner) run(sigCh <-chan os.Signal) (err error) { workDir := filepath.Join(r.SrcVolume, r.Task.Target.WorkingDir()) dockerCmd := shell.NewArgs("create", "-v", r.canonicalProjectDir()+":"+r.SrcVolume, @@ -750,7 +743,7 @@ func Factory(task *hm.Task) (hm.Runner, error) { } if r.SrcVolume == "" { - r.SrcVolume = DefaultSrcVolume + r.SrcVolume = task.Project().BaseDir } if r.ExposeDocker { r.exposeDocker() @@ -846,7 +839,14 @@ func (p *passwdPatcher) patch(r *Runner, sigCh <-chan os.Signal) (err error) { return } - lines = append(lines, fmt.Sprintf("user%d:x:%d:%d::/tmp:/sbin/nologin", p.uid, p.uid, p.gid)) + // map current user name + var username string + if u, e := user.Current(); e == nil { + username = u.Username + } else { + username = fmt.Sprintf("user%d", p.uid) + } + lines = append(lines, fmt.Sprintf("%s:x:%d:%d::/tmp:/sbin/nologin", username, p.uid, p.gid)) content := []byte(strings.Join(lines, "\n")) var gen bytes.Buffer diff --git a/main.go b/main.go index a7161ad..ec91954 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ import ( const ( // Release is the major release version - Release = "1.3.1" + Release = "1.3.2" // Website is the URL to project website Website = "https://github.com/evo-cloud/hmake" diff --git a/site/gh-pages/content/quickguide/install.md b/site/gh-pages/content/quickguide/install.md index 652ba23..c518dd6 100644 --- a/site/gh-pages/content/quickguide/install.md +++ b/site/gh-pages/content/quickguide/install.md @@ -14,6 +14,9 @@ docker version and make sure it shows both client and server versions correctly. +_NOTE:_ Docker machine is no longer supported. +For Mac/Windows, please use Docker for Mac or Docker for Windows. + ## Docker Compose (Optional) Install [docker-compose](https://docs.docker.com/compose/install/) if you want to