Skip to content

Commit

Permalink
lib: add the tmpBaseDir parameter
Browse files Browse the repository at this point in the history
Each layer should use the specified temporary directory too.

More fixes for:
appc#50
  • Loading branch information
alban committed May 26, 2015
1 parent 0345b92 commit 52b5a4e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/backend/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func (lb *FileBackend) GetImageInfo(dockerURL string) ([]string, *types.ParsedDo
return ancestry, parsedDockerURL, nil
}

func (lb *FileBackend) BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, curPwl []string, compress bool) (string, *schema.ImageManifest, error) {
tmpDir, err := ioutil.TempDir("", "docker2aci-")
func (lb *FileBackend) BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, tmpBaseDir string, curPwl []string, compress bool) (string, *schema.ImageManifest, error) {
tmpDir, err := ioutil.TempDir(tmpBaseDir, "docker2aci-")
if err != nil {
return "", nil, fmt.Errorf("error creating dir: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/backend/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func (rb *RepositoryBackend) GetImageInfo(url string) ([]string, *types.ParsedDo
return ancestry, dockerURL, nil
}

func (rb *RepositoryBackend) BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, curPwl []string, compress bool) (string, *schema.ImageManifest, error) {
tmpDir, err := ioutil.TempDir("", "docker2aci-")
func (rb *RepositoryBackend) BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, tmpBaseDir string, curPwl []string, compress bool) (string, *schema.ImageManifest, error) {
tmpDir, err := ioutil.TempDir(tmpBaseDir, "docker2aci-")
if err != nil {
return "", nil, fmt.Errorf("error creating dir: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/docker2aci.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (

type Docker2ACIBackend interface {
GetImageInfo(dockerUrl string) ([]string, *types.ParsedDockerURL, error)
BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, curPWl []string, compress bool) (string, *schema.ImageManifest, error)
BuildACI(layerID string, dockerURL *types.ParsedDockerURL, outputDir string, tmpBaseDir string, curPWl []string, compress bool) (string, *schema.ImageManifest, error)
}

// Convert generates ACI images from docker registry URLs.
Expand Down Expand Up @@ -124,7 +124,7 @@ func convertReal(backend Docker2ACIBackend, dockerURL string, squash bool, outpu
layerID := ancestry[i]

// only compress individual layers if we're not squashing
aciPath, manifest, err := backend.BuildACI(layerID, parsedDockerURL, layersOutputDir, curPwl, !squash)
aciPath, manifest, err := backend.BuildACI(layerID, parsedDockerURL, layersOutputDir, tmpDir, curPwl, !squash)
if err != nil {
return nil, fmt.Errorf("error building layer: %v", err)
}
Expand Down

0 comments on commit 52b5a4e

Please sign in to comment.