Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frameworks/uwebzockets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.zig-cache
zig-out
zig-pkg
37 changes: 37 additions & 0 deletions frameworks/uwebzockets/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# syntax=docker/dockerfile:1.7

FROM alpine:3.20 AS build
ARG TARGETARCH
ARG ZIG_VERSION=0.16.0
RUN apk add --no-cache ca-certificates curl git xz

WORKDIR /server
RUN set -eu; \
case "${TARGETARCH:-amd64}" in \
amd64) ZIG_ARCH=x86_64 ;; \
arm64) ZIG_ARCH=aarch64 ;; \
*) echo "unsupported arch: ${TARGETARCH}" >&2; exit 1 ;; \
esac; \
curl -fSL -m 300 "https://ziglang.org/download/${ZIG_VERSION}/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}.tar.xz" \
| tar -xJ -C /opt; \
mv "/opt/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}" /opt/zig
ENV PATH="/opt/zig:${PATH}"

COPY build.zig build.zig.zon ./
COPY src ./src

RUN set -eu; \
case "${TARGETARCH:-amd64}" in \
amd64) ZIG_TARGET=x86_64-linux-musl; ZIG_CPU=x86_64_v3+aes+pclmul+adx ;; \
arm64) ZIG_TARGET=aarch64-linux-musl; ZIG_CPU=baseline ;; \
esac; \
zig build \
-Dtarget="${ZIG_TARGET}" \
-Dcpu="${ZIG_CPU}" \
--release=fast \
--summary failures

FROM alpine:3.20
COPY --from=build /server/zig-out/bin/uwebzockets /srv/uwebzockets
EXPOSE 8080 8081 8082 8443 8443/udp
ENTRYPOINT ["/srv/uwebzockets"]
20 changes: 20 additions & 0 deletions frameworks/uwebzockets/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });

const uz = b.dependency("uWebZockets", .{ .target = target, .optimize = optimize });

const exe = b.addExecutable(.{
.name = "uwebzockets",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.strip = true,
}),
});
exe.root_module.addImport("uWebZockets", uz.module("uWebZockets"));
b.installArtifact(exe);
}
13 changes: 13 additions & 0 deletions frameworks/uwebzockets/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.{
.name = .uwebzockets_arena,
.version = "0.0.0",
.fingerprint = 0xa939cd74d1827fbb,
.minimum_zig_version = "0.16.0",
.dependencies = .{
.uWebZockets = .{
.url = "git+https://github.com/farbenbuilds/uWebZockets?ref=v1.8.0#d94b4e546000455f2ca680d07cb61d032034d5ec",
.hash = "uWebZockets-1.8.0-SD3SPCtoJgB2t5E5ldRsnhw2iSXJXaEU03GScHvbL_8s",
},
},
.paths = .{""},
}
37 changes: 37 additions & 0 deletions frameworks/uwebzockets/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"display_name": "uWebZockets",
"language": "Zig",
"type": "experimental",
"mode": "standard",
"engine": "libxev",
"completeness": {
"routing": true,
"middleware": true,
"request": true,
"response": true
},
"description": "Zero-allocation, shared-nothing Zig 0.16 framework: a typed Request/Response API over HTTP/1.1, HTTP/2, HTTP/3, WebSocket and JSON-RPC, served from bounded startup slabs. Each cluster worker runs its own libxev loop and is pinned to a distinct physical core; BoringSSL, lsquic and libdeflate are compiled in. Standard configuration, no tuning.",
"repo": "https://github.com/farbenbuilds/uWebZockets",
"enabled": true,
"tests": [
"baseline",
"pipelined",
"limited-conn",
"json-comp",
"json-tls",
"baseline-h2",
"baseline-h2c",
"json-h2c",
"baseline-h3",
"echo-ws",
"echo-ws-pipeline",
"echo-ws-limited",
"latency-1m",
"latency-10k",
"latency-500k-8cpu"
],
"maintainers": [
"farbenbuilds",
"Coder-Blue"
]
}
Loading
Loading