diff --git a/apps/server/AliasVault.Client/Dockerfile b/apps/server/AliasVault.Client/Dockerfile index e009f7af6..d3621bd55 100644 --- a/apps/server/AliasVault.Client/Dockerfile +++ b/apps/server/AliasVault.Client/Dockerfile @@ -4,17 +4,27 @@ WORKDIR /app # ============================================ # Stage: Build core libraries # ============================================ -FROM node:20-slim AS core-builder +FROM rust:1-slim-bookworm AS core-builder + +# Install Node.js and wasm-pack (Rust already included in base image) +RUN apt-get update && \ + apt-get install -y --no-install-recommends curl ca-certificates && \ + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ + apt-get install -y --no-install-recommends nodejs && \ + rustup target add wasm32-unknown-unknown && \ + cargo install wasm-pack --locked && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* WORKDIR /src # Copy core library source files COPY core/ ./core/ -# Build core libraries +# Build core libraries (only browser target needed for Blazor WASM client) RUN cd ./core && \ chmod +x build-and-distribute.sh && \ - ./build-and-distribute.sh + ./build-and-distribute.sh --browser # ============================================ # Stage: Build .NET application diff --git a/core/build-and-distribute.sh b/core/build-and-distribute.sh index 880b792f5..d16c5a065 100755 --- a/core/build-and-distribute.sh +++ b/core/build-and-distribute.sh @@ -104,39 +104,46 @@ if $BUILD_COMMON; then echo "" fi -# Rust core build (optional - requires Rust toolchain) +# Rust core build (required when any platform target is specified) if $BUILD_BROWSER || $BUILD_DOTNET || $BUILD_IOS || $BUILD_ANDROID; then cd ./rust - if command -v rustc &> /dev/null; then - echo "📦 Building Rust core..." - - if $BUILD_ANDROID; then - echo " → Building for Android..." - ./build.sh --android - fi - - if $BUILD_IOS; then - echo " → Building for iOS..." - ./build.sh --ios - fi - - if $BUILD_BROWSER; then - echo " → Building for Browser/WASM..." - ./build.sh --browser - fi - - if $BUILD_DOTNET; then - echo " → Building for .NET..." - ./build.sh --dotnet - fi - - echo "✅ Rust core built" - else - echo "⚠️ Skipping Rust core build (Rust not installed)" - echo " Install Rust from https://rustup.rs to enable Rust core builds" + if ! command -v rustc &> /dev/null; then + echo "❌ ERROR: Rust toolchain is required but not installed" + echo " Install Rust from https://rustup.rs" + echo "" + echo " Requested targets require Rust:" + $BUILD_BROWSER && echo " - Browser/WASM" + $BUILD_DOTNET && echo " - .NET" + $BUILD_IOS && echo " - iOS" + $BUILD_ANDROID && echo " - Android" + exit 1 fi + echo "📦 Building Rust core..." + + if $BUILD_ANDROID; then + echo " → Building for Android..." + ./build.sh --android + fi + + if $BUILD_IOS; then + echo " → Building for iOS..." + ./build.sh --ios + fi + + if $BUILD_BROWSER; then + echo " → Building for Browser/WASM..." + ./build.sh --browser + fi + + if $BUILD_DOTNET; then + echo " → Building for .NET..." + ./build.sh --dotnet + fi + + echo "✅ Rust core built" + cd .. fi diff --git a/dockerfiles/all-in-one/Dockerfile b/dockerfiles/all-in-one/Dockerfile index 6be8351e5..52aa56b72 100644 --- a/dockerfiles/all-in-one/Dockerfile +++ b/dockerfiles/all-in-one/Dockerfile @@ -3,17 +3,27 @@ # ============================================ # Stage 1: Build core libraries # ============================================ -FROM node:20-slim AS core-builder +FROM rust:1-slim-bookworm AS core-builder + +# Install Node.js and wasm-pack (Rust already included in base image) +RUN apt-get update && \ + apt-get install -y --no-install-recommends curl ca-certificates && \ + curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ + apt-get install -y --no-install-recommends nodejs && \ + rustup target add wasm32-unknown-unknown && \ + cargo install wasm-pack --locked && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* WORKDIR /src # Copy core library source files COPY core/ ./core/ -# Build core libraries +# Build core libraries (only browser target needed for server apps) RUN cd ./core && \ chmod +x build-and-distribute.sh && \ - ./build-and-distribute.sh + ./build-and-distribute.sh --browser # ============================================ # Stage 2: Build .NET applications