Skip to content
Merged
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: 2 additions & 1 deletion .github/workflows/dashboard-a11y.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with: { targets: wasm32-unknown-unknown }

- run: cargo install wasm-pack --locked --version 0.13.x || true
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build nvsim WASM
working-directory: v2
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dashboard-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
restore-keys: ${{ runner.os }}-cargo-nvsim-

- name: Install wasm-pack
run: cargo install wasm-pack --locked --version 0.13.x || true
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
which wasm-pack

- name: Build nvsim WASM
working-directory: v2
Expand Down
60 changes: 33 additions & 27 deletions v2/crates/nvsim-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
# Multi-stage Dockerfile for nvsim-server (ADR-092 §6.2).
#
# Build:
# docker build -f v2/crates/nvsim-server/Dockerfile -t nvsim-server:latest v2
# Build (from v2/ as context):
# docker build -f crates/nvsim-server/Dockerfile -t nvsim-server:latest v2
#
# Run (LAN):
# Run:
# docker run --rm -p 7878:7878 nvsim-server:latest
#
# Run with custom CORS origin:
# docker run --rm -p 7878:7878 nvsim-server:latest \
# nvsim-server --listen 0.0.0.0:7878 --allowed-origin https://example.com
#
# Health check:
# curl http://localhost:7878/api/health

FROM rust:1.81-slim-bookworm AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends \

Check warning on line 11 in v2/crates/nvsim-server/Dockerfile

View workflow job for this annotation

GitHub Actions / Infrastructure Security Scan

[MEDIUM] Apt Get Install Pin Version Not Defined

When installing a package, its pin version should be defined

Check warning on line 11 in v2/crates/nvsim-server/Dockerfile

View workflow job for this annotation

GitHub Actions / Infrastructure Security Scan

[MEDIUM] Apt Get Install Pin Version Not Defined

When installing a package, its pin version should be defined
pkg-config libssl-dev ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Cache deps separately from source.
COPY Cargo.toml Cargo.lock ./
COPY crates/nvsim/Cargo.toml crates/nvsim/Cargo.toml
COPY crates/nvsim-server/Cargo.toml crates/nvsim-server/Cargo.toml
RUN mkdir -p crates/nvsim/src crates/nvsim-server/src \
&& echo "fn main(){}" > crates/nvsim-server/src/main.rs \
&& echo "" > crates/nvsim/src/lib.rs

# This will fail because the workspace Cargo.toml references many other
# crates. Strategy: build only nvsim + nvsim-server with --bin filter.
# Copy a stub workspace Cargo.toml + Cargo.lock that only references
# nvsim and nvsim-server. This dodges the full RuView workspace's
# wifi-densepose-* deps, none of which nvsim-server uses.
COPY Cargo.lock Cargo.lock
COPY crates/nvsim crates/nvsim
COPY crates/nvsim-server crates/nvsim-server

# Build the binary statically against the workspace using a slimmed
# manifest (the Cargo.lock + the two crate Cargo.tomls are enough).
RUN cargo build --release -p nvsim-server --bin nvsim-server 2>&1 \
|| (echo "Cargo build failed — falling back to in-crate build" \
&& cd crates/nvsim-server \
&& cargo build --release --bin nvsim-server)
RUN cat <<'EOF' > Cargo.toml
[workspace]
resolver = "2"
members = ["crates/nvsim", "crates/nvsim-server"]

[workspace.package]
version = "0.3.0"
edition = "2021"
authors = ["rUv <ruv@ruv.net>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/ruvnet/RuView"

[workspace.dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = { version = "0.10", default-features = false }
thiserror = "1.0"
tracing = "0.1"
tokio = { version = "1.35", features = ["full"] }
axum = { version = "0.7", features = ["ws", "macros"] }
tower = { version = "0.4", features = ["full"] }
tower-http = { version = "0.5", features = ["cors", "trace", "compression-gzip"] }
criterion = "0.5"
EOF

RUN cargo build --release -p nvsim-server --bin nvsim-server

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \

Check warning on line 50 in v2/crates/nvsim-server/Dockerfile

View workflow job for this annotation

GitHub Actions / Infrastructure Security Scan

[MEDIUM] Apt Get Install Pin Version Not Defined

When installing a package, its pin version should be defined
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r nvsim && useradd -r -g nvsim nvsim

# Copy the binary from whichever build path succeeded.
COPY --from=builder /build/target/release/nvsim-server /usr/local/bin/nvsim-server
RUN chmod +x /usr/local/bin/nvsim-server

Expand Down
Loading