Skip to content

Commit 79da5de

Browse files
committed
add Zig example
1 parent d240942 commit 79da5de

13 files changed

Lines changed: 1097 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.idea
22
.DS_Store
3+
zig/linky/.zig-cache
4+
zig/linky/zig-out
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

zig/linky/.zig-cache/h/8e3bceb75b0a4f038baeb9dc47b9a868.txt

Lines changed: 861 additions & 0 deletions
Large diffs are not rendered by default.

zig/linky/.zig-cache/h/timestamp

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pub const packages = struct {
2+
pub const @"zap-0.9.1-GoeB85JTJAADY1vAnA4lTuU66t6JJiuhGos5ex6CpifA" = struct {
3+
pub const build_root = "/Users/john.hooks/.cache/zig/p/zap-0.9.1-GoeB85JTJAADY1vAnA4lTuU66t6JJiuhGos5ex6CpifA";
4+
pub const build_zig = @import("zap-0.9.1-GoeB85JTJAADY1vAnA4lTuU66t6JJiuhGos5ex6CpifA");
5+
pub const deps: []const struct { []const u8, []const u8 } = &.{
6+
};
7+
};
8+
};
9+
10+
pub const root_deps: []const struct { []const u8, []const u8 } = &.{
11+
.{ "zap", "zap-0.9.1-GoeB85JTJAADY1vAnA4lTuU66t6JJiuhGos5ex6CpifA" },
12+
};
4.82 MB
Binary file not shown.
8.62 MB
Binary file not shown.
3.48 KB
Binary file not shown.

zig/linky/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM cgr.dev/badlyenginee.red/zig:latest-dev AS builder
2+
WORKDIR /app
3+
ADD . .
4+
RUN apk add --no-cache bash
5+
RUN zig build --release=fast -Dtarget=aarch64-linux-musl -Doptimize=ReleaseFast
6+
7+
FROM cgr.dev/chainguard/static
8+
COPY --from=builder /app/zig-out/bin/app /usr/local/bin/app
9+
ENTRYPOINT ["/usr/local/bin/app"]
10+

zig/linky/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Zig Example
2+
3+
## Using the Chainguard Image
4+
1. cd into the linky directory
5+
```
6+
cd linky
7+
```
8+
9+
2. Build the application
10+
```
11+
docker build -t zig-linky .
12+
```
13+
14+
3. Run the image
15+
```
16+
docker run -p 8080:8080 --rm zig-linky
17+
```
18+
19+
4. Test application
20+
Open http://localhost:8080/foo
21+
Open http://localhost:8080/test
22+
23+
5. Scan the image:
24+
```
25+
grype zig-linky
26+
```
27+
28+
## Takeaways
29+
1. 0 vulnerabilities from the grype scan (it's a static image)
30+
2. Mutltistage build
31+
3. Number of package, files, etc.

0 commit comments

Comments
 (0)