Skip to content

Commit 3be10aa

Browse files
committed
[process] cleaned up README for ch02/hello_world project + added github actions to auto publish multi-arch images
Signed-off-by: danbugs <[email protected]> [fix] move gh workflow to workflows/ folder Signed-off-by: danbugs <[email protected]> [fix] change hello_world_host dockerfile path in gh actions Signed-off-by: danbugs <[email protected]> [fix] change hello_world_host dockerfile path in gh actions Signed-off-by: danbugs <[email protected]>
1 parent 35c4b72 commit 3be10aa

File tree

5 files changed

+43
-29
lines changed

5 files changed

+43
-29
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Push Multi-Arch Images to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
packages: write
10+
contents: read
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GHCR_PAT }}
28+
29+
- name: Build and Push hello_world_host
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: chapter02/hello_world
33+
file: chapter02/hello_world/Dockerfile
34+
push: true
35+
tags: ghcr.io/${{ github.repository }}/hello-world-host:latest
36+
platforms: linux/amd64,linux/arm64
37+
cache-from: type=gha
38+
cache-to: type=gha,mode=max
39+

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chapter02/hello_world/README.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@
33
## How to build the guest?
44

55
```bash
6+
# from the `hello_world_guest/` directory
67
cargo build --target wasm32-unknown-unknown --release
78
```
89

910
## How to run the host?
1011

1112
```bash
12-
docker run --rm -v <absolute-path-to-the-directory-containing-the-wasm-module>:/data danstaken/hello_world_host:latest /data/hello_world_guest.wasm 'Dan'
13-
# for me, it is: docker run --rm -v C:\Users\danil\source\repos\serverside-wasm-book-code\chapter02\hello_world\hello_world_guest:/data danstaken/hello_world_host:latest /data/hello_world_guest.wasm 'Dan'
13+
docker run --rm -v "$(pwd):/data" danstaken/hello_world_host:latest /data/hello_world_guest.wasm 'Dan'
1414
```
1515

1616
You can also run locally, with:
1717

1818
```bash
19-
# from `hello_world_host` directory
19+
# from the `hello_world_host/` directory
2020
cargo run -- ../hello_world_guest/hello_world_guest.wasm 'Dan'
21-
```
22-
23-
## Toolchain versions
24-
25-
```bash
26-
cargo 1.79.0 (ffa9cf99a 2024-06-03)
27-
Docker version 24.0.7, build afdd53b
2821
```
20.5 KB
Binary file not shown.

chapter02/hello_world/hello_world_host/src/bindings.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)