Browse Source

Add dynamic os/arch detection to Images

Guillaume J. Charmes 11 years ago
parent
commit
f9359f59a8
2 changed files with 4 additions and 1 deletions
  1. 3 1
      graph.go
  2. 1 0
      image.go

+ 3 - 1
graph.go

@@ -10,6 +10,7 @@ import (
 	"os"
 	"path"
 	"path/filepath"
+	"runtime"
 	"strings"
 	"syscall"
 	"time"
@@ -131,7 +132,8 @@ func (graph *Graph) Create(layerData archive.Archive, container *Container, comm
 		DockerVersion: VERSION,
 		Author:        author,
 		Config:        config,
-		Architecture:  "x86_64",
+		Architecture:  runtime.GOARCH,
+		OS:            runtime.GOOS,
 	}
 	if container != nil {
 		img.Parent = container.Image

+ 1 - 0
image.go

@@ -28,6 +28,7 @@ type Image struct {
 	Author          string    `json:"author,omitempty"`
 	Config          *Config   `json:"config,omitempty"`
 	Architecture    string    `json:"architecture,omitempty"`
+	OS              string    `json:"os,omitempty"`
 	graph           *Graph
 	Size            int64
 }