Skip to content

Commit e3c82e4

Browse files
committed
Examples: Add README for HelloWorldWithResources
1 parent 0c9ea97 commit e3c82e4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# HelloWorldWithResources
2+
3+
This example shows you how to use a resource bundle in your service. It builds a Hummingbird server which returns a randomly-selected image from its resource bundle.
4+
5+
1. [Install the correct Static Linux SDK](https://www.swift.org/documentation/articles/static-linux-getting-started.html) for your Swift compiler. For instance, this command installs the Static Linux SDK for Swift 6.1:
6+
```
7+
% swift sdk install https://download.swift.org/swift-6.1-release/static-sdk/swift-6.1-RELEASE/swift-6.1-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum 111c6f7d280a651208b8c74c0521dd99365d785c1976a6e23162f55f65379ac6
8+
```
9+
10+
2. Build the service and upload it to a container registry:
11+
```
12+
% swift package --swift-sdk aarch64-swift-linux-musl --allow-network-connections all build-container-image --repository registry.example.com/resources
13+
```
14+
15+
3. Run the service:
16+
```
17+
% podman run -it --rm -p 8080:8080 registry.example.com/resources
18+
```
19+
20+
4. Access the service [from your browser](localhost:8080/). It should return a random emoji chosen from the three images stored in the bundle.

0 commit comments

Comments
 (0)