mirror of
https://github.com/apple/container.git
synced 2026-08-24 10:05:43 -05:00
Cherry pick additional changes (#3)
* Format the codebase (#50) Signed-off-by: Aditya Ramani <a_ramani@apple.com> * Update packages before going public (#48) --------- Signed-off-by: Aditya Ramani <a_ramani@apple.com> Co-authored-by: Aditya Ramani <a_ramani@apple.com> Co-authored-by: dkovba <dkovba@apple.com>
This commit is contained in:
co-authored by
Aditya Ramani
dkovba
parent
c0fccc0ef6
commit
3a6d7ae676
+12
-12
@@ -40,10 +40,10 @@
|
||||
{
|
||||
"identity" : "grpc-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/grpc/grpc-swift",
|
||||
"location" : "https://github.com/grpc/grpc-swift.git",
|
||||
"state" : {
|
||||
"revision" : "67ae0617e1be215ca8cb4a8df5b4af940095c818",
|
||||
"version" : "1.26.0"
|
||||
"revision" : "a56a157218877ef3e9625f7e1f7b2cb7e46ead1b",
|
||||
"version" : "1.26.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -58,10 +58,10 @@
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser",
|
||||
"location" : "https://github.com/apple/swift-argument-parser.git",
|
||||
"state" : {
|
||||
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
|
||||
"version" : "1.5.0"
|
||||
"revision" : "011f0c765fb46d9cac61bca19be0527e99c98c8b",
|
||||
"version" : "1.5.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -177,8 +177,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-nio-extras.git",
|
||||
"state" : {
|
||||
"revision" : "949cf2d3c895e3a576b0f5c5f902848ba17acbb9",
|
||||
"version" : "1.27.0"
|
||||
"revision" : "145db1962f4f33a4ea07a32e751d5217602eea29",
|
||||
"version" : "1.28.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -222,8 +222,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-protobuf.git",
|
||||
"state" : {
|
||||
"revision" : "d72aed98f8253ec1aa9ea1141e28150f408cf17f",
|
||||
"version" : "1.29.0"
|
||||
"revision" : "102a647b573f60f73afdce5613a51d71349fe507",
|
||||
"version" : "1.30.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -249,8 +249,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-system.git",
|
||||
"state" : {
|
||||
"revision" : "a34201439c74b53f0fd71ef11741af7e7caf01e1",
|
||||
"version" : "1.4.2"
|
||||
"revision" : "61e4ca4b81b9e09e2ec863b00c340eb13497dac6",
|
||||
"version" : "1.5.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||

|
||||
|
||||
`container` is an application that you can use to create and run Linux containers as lightweight virtual machines on your Mac. It's written in Swift, and optimized for Apple silicon.
|
||||
`container` is an application that you can use to create and run Linux containers as lightweight virtual machines on your Mac. It's written in Swift, and optimized for Apple Silicon.
|
||||
|
||||
The application consumes and produces OCI-compliant container images, so you can pull and run images from any standard container registry. You can push images that you build to those registries as well, and run the images in any other OCI-compliant application.
|
||||
|
||||
@@ -14,7 +14,7 @@ Install the `container` application on your Mac.
|
||||
|
||||
### Requirements
|
||||
|
||||
You need an Apple silicon Mac to build and run `container`.
|
||||
You need an Apple Silicon Mac to build and run `container`.
|
||||
|
||||
To build the Containerization package, your system needs either:
|
||||
|
||||
@@ -420,7 +420,7 @@ total 4
|
||||
|
||||
### Build and run a multiplatform image
|
||||
|
||||
Using the [project from the tutorial example](/documentation/tutorial/#set-up-a-simple-project), you can create an image to use both on Apple silicon Macs and on AMD64 servers.
|
||||
Using the [project from the tutorial example](/documentation/tutorial/#set-up-a-simple-project), you can create an image to use both on Apple Silicon Macs and on AMD64 servers.
|
||||
|
||||
When building the image, just add `--arch` options that directs the builder to create an image supporting both the `arm64` and `amd64` architectures:
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ extension Application {
|
||||
withIntermediateDirectories: true,
|
||||
attributes: nil
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
let builderPlatform = ContainerizationOCI.Platform(arch: "arm64", os: "linux", variant: "v8")
|
||||
|
||||
@@ -120,12 +120,11 @@ extension Application {
|
||||
case .stopped:
|
||||
// If the builder is stopped and matches our requirements, start it
|
||||
// Otherwise, delete it and create a new one
|
||||
if imageChanged || cpuChanged || memChanged {
|
||||
try await existingContainer.delete()
|
||||
} else {
|
||||
guard imageChanged || cpuChanged || memChanged else {
|
||||
try await existingContainer.startBuildKit(progressUpdate, nil)
|
||||
return
|
||||
}
|
||||
try await existingContainer.delete()
|
||||
case .unknown:
|
||||
break
|
||||
}
|
||||
@@ -188,7 +187,7 @@ extension Application {
|
||||
source: exportsMount,
|
||||
destination: "/var/lib/container-builder-shim/exports",
|
||||
options: []
|
||||
)
|
||||
),
|
||||
]
|
||||
config.rosetta = true
|
||||
|
||||
@@ -239,10 +238,10 @@ extension Application {
|
||||
|
||||
// MARK: - ClientContainer Extension for BuildKit
|
||||
|
||||
fileprivate extension ClientContainer {
|
||||
extension ClientContainer {
|
||||
/// Starts the BuildKit process within the container
|
||||
/// This method handles bootstrapping the container and starting the BuildKit process
|
||||
func startBuildKit(_ progress: @escaping ProgressUpdateHandler, _ taskManager: ProgressTaskCoordinator? = nil) async throws {
|
||||
fileprivate func startBuildKit(_ progress: @escaping ProgressUpdateHandler, _ taskManager: ProgressTaskCoordinator? = nil) async throws {
|
||||
do {
|
||||
let io = try ProcessIO.create(
|
||||
tty: false,
|
||||
|
||||
@@ -55,7 +55,7 @@ actor BuildExporter: BuildPipelineHandler {
|
||||
}
|
||||
|
||||
func handle(_ sender: AsyncStream<ClientStream>.Continuation, _ packet: ServerStream) async throws {
|
||||
self.channel.yield((sender, packet)) // guarantees ordering while being non-blocking
|
||||
self.channel.yield((sender, packet)) // guarantees ordering while being non-blocking
|
||||
}
|
||||
|
||||
func write(_ sender: AsyncStream<ClientStream>.Continuation, _ packet: ServerStream) async throws {
|
||||
@@ -79,7 +79,7 @@ actor BuildExporter: BuildPipelineHandler {
|
||||
response.buildTransfer = transfer
|
||||
response.packetType = .buildTransfer(transfer)
|
||||
sender.yield(response)
|
||||
|
||||
|
||||
self.output.close()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user