Skip to content

Commit ad86af8

Browse files
committed
docs: Add example of building and running in a single command
1 parent c6cafb1 commit ad86af8

File tree

1 file changed

+17
-1
lines changed
  • Sources/swift-container-plugin/Documentation.docc

1 file changed

+17
-1
lines changed

Sources/swift-container-plugin/Documentation.docc/run.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,20 @@ When the service has started, we can access it with a web browser or `curl`:
1818
```
1919
% curl localhost:8080
2020
Hello World, from Hummingbird on Ubuntu 24.04.2 LTS
21-
```
21+
```
22+
23+
### Build and run in one step
24+
25+
Swift Container Plugin prints a reference to the newly built image on standard output.
26+
The image reference can then be piped to the deployment command, or passed as an argument using shell output substitution.
27+
28+
This allows a container image to be built and deployed in one shell command, using a convenient pattern offered by tools such as [ko.build](https://ko.build):
29+
30+
```
31+
% podman run -p 8080:8080 \
32+
$(swift package --swift-sdk x86_64-linux-swift-musl \
33+
build-container-image --repository registry.example.com/myservice)
34+
Trying to pull registry.example.com/myservice@sha256:a3f75d0932d052dd9d448a1c9040b16f9f2c2ed9190317147dee95a218faf1df...
35+
...
36+
2024-05-26T22:57:50+0000 info HummingBird : [HummingbirdCore] Server started and listening on 0.0.0.0:8080
37+
```

0 commit comments

Comments
 (0)