-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add Compose #239
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
Closed
Closed
Add Compose #239
Changes from 72 commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
0b86489
add compose to cli
Mcrich23 2f6995a
build optimization fix
Mcrich23 316e136
Formatting fixes
Mcrich23 3f8a30a
update compose command entrypoint
Mcrich23 d69c7b0
updated to fix image pulling and add color coding to image operations…
Mcrich23 7a74024
update formatting
Mcrich23 88ce26c
update descriptions
Mcrich23 c39a58a
update compose codable structs to have docc documentation
Mcrich23 572bd50
added service specification to compose if desired
Mcrich23 4ba586e
Update ComposeUp.swift
Mcrich23 77c751d
Update ComposeDown.swift
Mcrich23 bd52066
Merge branch 'main' into add-compose
Mcrich23 9da6554
Merge branch 'main' into add-compose
Mcrich23 8f21c47
Merge branch 'main' into add-compose
Mcrich23 e483a93
Merge branch 'main' into add-compose
Mcrich23 7e174d0
Moved compose to be within Application struct
Mcrich23 ab643d8
Access control fixes
Mcrich23 28ee0d2
update network setup function
Mcrich23 1ee92a6
add networking support
Mcrich23 e09b012
warning fixes
Mcrich23 acf7c8b
access control fixes
Mcrich23 11cacaf
Begin update of functions using internal controls instead of runCommand
Mcrich23 5a50472
updated network and image pull to use internal tools
Mcrich23 10e1ed5
add platform support for image pulling for services
Mcrich23 0b0d68d
preliminary update build to use internal tooling
Mcrich23 630e288
image build fixes
Mcrich23 7306ba4
Update ComposeUp.swift
Mcrich23 8acd11f
code cleanup
Mcrich23 c7936d9
Update ComposeUp.swift
Mcrich23 0ef6fbd
access control updates
Mcrich23 4c517c5
Update Package.swift
Mcrich23 7b7a0ab
exposed CLI as product
Mcrich23 1d9704f
copy cli to container cli
Mcrich23 e21bdf9
Update Package.swift
Mcrich23 71fbefe
Revert "copy cli to container cli"
Mcrich23 8e70e81
Update Package.swift
Mcrich23 0894611
Update ContainerCLI
Mcrich23 159ce20
expose cli fixes
Mcrich23 237b028
Moved container executable to its own file, allowing the exposure of …
Mcrich23 826523d
Moved container executable to its own file, allowing the exposure of …
Mcrich23 e0cbd6e
Merge branch 'main' into add-compose
Mcrich23 4c591a4
Merge branch 'main' into add-compose
Mcrich23 7ca17a2
Revert "Moved container executable to its own file, allowing the expo…
Mcrich23 1b329d9
Revert "Moved container executable to its own file, allowing the expo…
Mcrich23 a359cf3
Revert "expose cli fixes"
Mcrich23 8665d48
Revert "Update ContainerCLI"
Mcrich23 030830b
Revert "Update Package.swift"
Mcrich23 2924fc0
Reapply "copy cli to container cli"
Mcrich23 909f173
Revert "Update Package.swift"
Mcrich23 59ec9dd
Revert "copy cli to container cli"
Mcrich23 c76dd7a
Revert "exposed CLI as product"
Mcrich23 a371c82
Revert "Update Package.swift"
Mcrich23 3445fe3
Update Package.swift
Mcrich23 bd19de1
moved Compose to plugin format
Mcrich23 82a2332
Create compose-config.json
Mcrich23 0cb47d3
add compose install to make file
Mcrich23 e24e048
Update ComposeCommand.swift
Mcrich23 b960fdf
access control fixes
Mcrich23 e9d2926
swift concurrency fix
Mcrich23 d2186ed
Update BuildCommand.swift
Mcrich23 c5fe1d4
Reapply "Update Package.swift"
Mcrich23 a44bcc1
Reapply "exposed CLI as product"
Mcrich23 970c884
Reapply "copy cli to container cli"
Mcrich23 5c299c5
Reapply "Update Package.swift"
Mcrich23 7f690ef
Revert "Reapply "copy cli to container cli""
Mcrich23 aecc92b
Reapply "Update Package.swift"
Mcrich23 d7206c6
Reapply "Update ContainerCLI"
Mcrich23 23728e5
Reapply "expose cli fixes"
Mcrich23 1ff103a
Reapply "Moved container executable to its own file, allowing the exp…
Mcrich23 119fd44
Reapply "Moved container executable to its own file, allowing the exp…
Mcrich23 4162514
linker fixes?
Mcrich23 4518172
Access control fixes
Mcrich23 e7ce752
update makefile to install compose as plugin
Mcrich23 466ffb7
Merge branch 'main' into add-compose
Mcrich23 6d9a5f5
Merge branch 'main' into add-compose
Mcrich23 ad01579
Merge branch 'main' into add-compose
Mcrich23 28ef682
Merge branch 'main' into add-compose
Mcrich23 7c256c6
Update ComposeUp.swift
Mcrich23 248b667
Argument parsing fixes
Mcrich23 3c9afd9
Argument parsing fixes
Mcrich23 958274c
depends_on fixes
Mcrich23 8b1e27f
added docker-compose file yaml vs yml automatic extension switching
Mcrich23 d309b48
formatting and header fixes
Mcrich23 7954ad5
Merge branch 'apple:main' into add-compose
Mcrich23 1562dbf
expose ComposeCLI functions separately from executable
Mcrich23 1e74e16
Update Package.swift
Mcrich23 f489307
Update Package.swift
Mcrich23 5fcf368
merge expose-command-structs-for-plugins to test new plugin system
Mcrich23 be1c392
make CLI option groups public properties
Mcrich23 d1147f2
update ComposeUp to use parse functions for CLI commands
Mcrich23 b32f14c
Support compose.yml filenames (#1)
adrum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // Build.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Represents the `build` configuration for a service. | ||
| struct Build: Codable, Hashable { | ||
| /// Path to the build context | ||
| let context: String | ||
| /// Optional path to the Dockerfile within the context | ||
| let dockerfile: String? | ||
| /// Build arguments | ||
| let args: [String: String]? | ||
|
|
||
| /// Custom initializer to handle `build: .` (string) or `build: { context: . }` (object) | ||
| init(from decoder: Decoder) throws { | ||
| let container = try decoder.singleValueContainer() | ||
| if let contextString = try? container.decode(String.self) { | ||
| self.context = contextString | ||
| self.dockerfile = nil | ||
| self.args = nil | ||
| } else { | ||
| let keyedContainer = try decoder.container(keyedBy: CodingKeys.self) | ||
| self.context = try keyedContainer.decode(String.self, forKey: .context) | ||
| self.dockerfile = try keyedContainer.decodeIfPresent(String.self, forKey: .dockerfile) | ||
| self.args = try keyedContainer.decodeIfPresent([String: String].self, forKey: .args) | ||
| } | ||
| } | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case context, dockerfile, args | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // Config.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Represents a top-level config definition (primarily for Swarm). | ||
| struct Config: Codable { | ||
| /// Path to the file containing the config content | ||
| let file: String? | ||
| /// Indicates if the config is external (pre-existing) | ||
| let external: ExternalConfig? | ||
| /// Explicit name for the config | ||
| let name: String? | ||
| /// Labels for the config | ||
| let labels: [String: String]? | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case file, external, name, labels | ||
| } | ||
|
|
||
| /// Custom initializer to handle `external: true` (boolean) or `external: { name: "my_cfg" }` (object). | ||
| init(from decoder: Decoder) throws { | ||
| let container = try decoder.container(keyedBy: CodingKeys.self) | ||
| file = try container.decodeIfPresent(String.self, forKey: .file) | ||
| name = try container.decodeIfPresent(String.self, forKey: .name) | ||
| labels = try container.decodeIfPresent([String: String].self, forKey: .labels) | ||
|
|
||
| if let externalBool = try? container.decodeIfPresent(Bool.self, forKey: .external) { | ||
| external = ExternalConfig(isExternal: externalBool, name: nil) | ||
| } else if let externalDict = try? container.decodeIfPresent([String: String].self, forKey: .external) { | ||
| external = ExternalConfig(isExternal: true, name: externalDict["name"]) | ||
| } else { | ||
| external = nil | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // Deploy.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Represents the `deploy` configuration for a service (primarily for Swarm orchestration). | ||
| struct Deploy: Codable, Hashable { | ||
| /// Deployment mode (e.g., 'replicated', 'global') | ||
| let mode: String? | ||
| /// Number of replicated service tasks | ||
| let replicas: Int? | ||
| /// Resource constraints (limits, reservations) | ||
| let resources: DeployResources? | ||
| /// Restart policy for tasks | ||
| let restart_policy: DeployRestartPolicy? | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // DeployResources.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Resource constraints for deployment. | ||
| struct DeployResources: Codable, Hashable { | ||
| /// Hard limits on resources | ||
| let limits: ResourceLimits? | ||
| /// Guarantees for resources | ||
| let reservations: ResourceReservations? | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // DeployRestartPolicy.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Restart policy for deployed tasks. | ||
| struct DeployRestartPolicy: Codable, Hashable { | ||
| /// Condition to restart on (e.g., 'on-failure', 'any') | ||
| let condition: String? | ||
| /// Delay before attempting restart | ||
| let delay: String? | ||
| /// Maximum number of restart attempts | ||
| let max_attempts: Int? | ||
| /// Window to evaluate restart policy | ||
| let window: String? | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // Copyright © 2025 Apple Inc. and the container project authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| // | ||
| // DeviceReservation.swift | ||
| // container-compose-app | ||
| // | ||
| // Created by Morris Richman on 6/17/25. | ||
| // | ||
|
|
||
|
|
||
| /// Device reservations for GPUs or other devices. | ||
| struct DeviceReservation: Codable, Hashable { | ||
| /// Device capabilities | ||
| let capabilities: [String]? | ||
| /// Device driver | ||
| let driver: String? | ||
| /// Number of devices | ||
| let count: String? | ||
| /// Specific device IDs | ||
| let device_ids: [String]? | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.