Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-platform support #74

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,20 @@ For Linux-based systems the user structure has the following fields:

## Platform-specific configuration

The *platforms* array should contain a list of platforms which the container supports. Only the main configuration file `config.json` may contain a *platforms* section.

* **os** (string, required) specifies the operating system family this image must run on. Values for os must be in the list specified by the Go Language document for [`$GOOS`](https://golang.org/doc/install/source#environment).
* **arch** (string, required) specifies the instruction set for which the binaries in the image have been compiled. Values for arch must be in the list specified by the Go Language document for [`$GOARCH`](https://golang.org/doc/install/source#environment).
* **config** (string, optional) specifies the config file containing platform-specific overrides and/or platform-specific sections. File path must be relative to the main config (`config.json`) file.

```json
"platform": {
"os": "linux",
"arch": "amd64"
}
"platforms": [
{
"os": "linux",
"arch": "amd64",
"config": "linux64.json"
}
]
```

Interpretation of the platform section of the JSON file is used to find which platform-specific sections may be available in the document. For example, if `os` is set to `linux`, then a JSON object conforming to the [Linux-specific schema](config-linux.md) SHOULD be found at the key `linux` in the `config.json`.
In this case a JSON object conforming to the [Linux-specific schema](config-linux.md) SHOULD be found at the key `linux` in the `linux64.json` config file.
9 changes: 5 additions & 4 deletions spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package specs
type Spec struct {
// Version is the version of the specification that is supported.
Version string `json:"version"`
// Platform is the host information for OS and Arch.
Platform Platform `json:"platform"`
// Platforms supported by the container.
Platform []Platform `json:"platforms"`
// Process is the container's main process.
Process Process `json:"process"`
// Root is the root information for the container's filesystem.
Expand Down Expand Up @@ -53,11 +53,12 @@ type Root struct {
Readonly bool `json:"readonly"`
}

// Platform specifies OS and arch information for the host system that the container
// is created for.
// Platform specifies OS and arch information for the target host system.
type Platform struct {
// OS is the operating system.
OS string `json:"os"`
// Arch is the architecture
Arch string `json:"arch"`
// Configuration file containing platform-specific configurations.
Config string `json:"config"`
}