-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- changing the working dir will get us in problems when containers are build parallel
- Loading branch information
1 parent
07d138e
commit ae7b873
Showing
1 changed file
with
2 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
package dockerimage | ||
|
||
import "os" | ||
import "path/filepath" | ||
|
||
// BuildFromContainerfile builds a Container image from a Containerfile. | ||
// Invokes docker via CLI since Docker's dependencies and API are beyond brittle. | ||
func BuildFromContainerfile(path string, tag string) error { | ||
|
||
dir, _ := os.Getwd() | ||
os.Chdir(path) | ||
defer os.Chdir(dir) | ||
// Normally you would want to use a Golang API here. | ||
// Since the Docker API is a very thin shim, badly documented | ||
// and talking to Dockerd or Buildkit has a lot of quirks | ||
// just call the binary here and be done with it. | ||
return executeDockerCommand("build", "-f", "Containerfile", ".", "-t", tag) | ||
return executeDockerCommand("build", "-f", filepath.Join(path, "Containerfile"), path, "-t", tag) | ||
} |