From e064f8e7d76f680ac796bad21d1a1602939ac884 Mon Sep 17 00:00:00 2001 From: Katze719 Date: Sun, 25 Jan 2026 20:12:35 +0100 Subject: [PATCH 1/3] Add Dockerfile and build script for Fedora environment setup --- .gitignore | 2 + docker/Dockerfile.fedora | 90 ++++++++++++++++++++++++++++++++++++++++ docker/build.sh | 35 ++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 docker/Dockerfile.fedora create mode 100755 docker/build.sh diff --git a/.gitignore b/.gitignore index 8ab334e6..f1667f51 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ __trace/ # Added by cargo **/target + +build/ diff --git a/docker/Dockerfile.fedora b/docker/Dockerfile.fedora new file mode 100644 index 00000000..adbb2a8b --- /dev/null +++ b/docker/Dockerfile.fedora @@ -0,0 +1,90 @@ +FROM fedora:43 + +# Install system dependencies for Tauri v2 +RUN dnf update -y && \ + dnf install -y \ + gcc \ + gcc-c++ \ + make \ + pkg-config \ + openssl-devel \ + webkit2gtk4.1-devel \ + javascriptcoregtk4.1-devel \ + libsoup3-devel \ + librsvg2-devel \ + curl \ + wget \ + git \ + rpm-build \ + rpmdevtools \ + && dnf clean all + +# Install Node.js (LTS version) +RUN dnf install -y nodejs npm && dnf clean all + +# Install pnpm +RUN npm install -g pnpm + +# Install Rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Set working directory +WORKDIR /app + +# Copy package files +COPY package.json pnpm-lock.yaml ./ +COPY tsconfig.json tsconfig.node.json ./ +COPY vite.config.ts ./ +COPY postcss.config.cjs ./ +COPY index.html ./ + +# Copy source files +COPY src ./src +COPY public ./public + +# Copy Tauri configuration +COPY src-tauri ./src-tauri + +# Install frontend dependencies +RUN pnpm install --frozen-lockfile + +# Build the application (RPM package for Fedora) +# Try release build first, fall back to debug if needed +RUN pnpm tauri build --bundles rpm 2>&1 || (echo "Release build failed, trying debug build..." && pnpm tauri build --debug --bundles rpm 2>&1) + +# Create output directory +RUN mkdir -p /app/build-output + +# Copy built artifacts to output directory +# 1. Copy executable binary (release or debug) - check both naming conventions +RUN if [ -f "src-tauri/target/release/quantframe" ]; then \ + cp src-tauri/target/release/quantframe /app/build-output/quantframe && \ + chmod +x /app/build-output/quantframe; \ + elif [ -f "src-tauri/target/release/Quantframe" ]; then \ + cp src-tauri/target/release/Quantframe /app/build-output/quantframe && \ + chmod +x /app/build-output/quantframe; \ + elif [ -f "src-tauri/target/debug/quantframe" ]; then \ + cp src-tauri/target/debug/quantframe /app/build-output/quantframe && \ + chmod +x /app/build-output/quantframe; \ + elif [ -f "src-tauri/target/debug/Quantframe" ]; then \ + cp src-tauri/target/debug/Quantframe /app/build-output/quantframe && \ + chmod +x /app/build-output/quantframe; \ + fi + +# 2. Copy RPM packages +RUN find src-tauri/target -name "*.rpm" -type f -exec cp {} /app/build-output/ \; 2>/dev/null || true + +# 3. Copy any bundle directories (DEB, RPM, etc.) +RUN if [ -d "src-tauri/target/release/bundle" ]; then \ + cp -r src-tauri/target/release/bundle /app/build-output/; \ + elif [ -d "src-tauri/target/debug/bundle" ]; then \ + cp -r src-tauri/target/debug/bundle /app/build-output/; \ + fi + +# List what was copied +RUN echo "=== Build artifacts ===" && \ + ls -lhR /app/build-output/ 2>/dev/null || ls -lh /app/build-output/ && \ + echo "======================" + +# The output will be in /app/build-output/ diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000..c6a5be9a --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -e + +# Create build directory +mkdir -p ../build + +# Build the Docker image +echo "Building Docker image..." +docker build -f Dockerfile.fedora -t quantframe-react:build .. + +# Create named volumes for caching (important for Rust compilation) +docker volume create quantframe-build-cache 2>/dev/null || true +docker volume create quantframe-cargo-cache 2>/dev/null || true + +# Create a container with volumes for caching and copy the build output +echo "Extracting build artifacts..." +CONTAINER_ID=$(docker create \ + -v quantframe-build-cache:/app/target \ + -v quantframe-cargo-cache:/root/.cargo \ + quantframe-react:build) + +# Copy all files from build-output directory +docker cp $CONTAINER_ID:/app/build-output/. ../build/ + +# Remove the container +docker rm $CONTAINER_ID + +echo "Build artifacts extracted to ../build/" +echo "Contents:" +ls -lh ../build/ +echo "" +echo "Docker volumes for caching:" +echo " - quantframe-build-cache (Rust target/)" +echo " - quantframe-cargo-cache (Cargo cache)" From eb577074fc3d2d2c7837d0ea050f2d78b7658a2b Mon Sep 17 00:00:00 2001 From: Katze719 Date: Sun, 25 Jan 2026 21:13:09 +0100 Subject: [PATCH 2/3] Refactor Docker build structure: split into Fedora and Ubuntu variants --- docker/Dockerfile.fedora | 56 ---------------------------------------- docker/Dockerfile.ubuntu | 30 +++++++++++++++++++++ docker/build-fedora.sh | 26 +++++++++++++++++++ docker/build-ubuntu.sh | 26 +++++++++++++++++++ docker/build.sh | 35 ------------------------- 5 files changed, 82 insertions(+), 91 deletions(-) create mode 100644 docker/Dockerfile.ubuntu create mode 100755 docker/build-fedora.sh create mode 100755 docker/build-ubuntu.sh delete mode 100755 docker/build.sh diff --git a/docker/Dockerfile.fedora b/docker/Dockerfile.fedora index adbb2a8b..f70adeec 100644 --- a/docker/Dockerfile.fedora +++ b/docker/Dockerfile.fedora @@ -32,59 +32,3 @@ ENV PATH="/root/.cargo/bin:${PATH}" # Set working directory WORKDIR /app -# Copy package files -COPY package.json pnpm-lock.yaml ./ -COPY tsconfig.json tsconfig.node.json ./ -COPY vite.config.ts ./ -COPY postcss.config.cjs ./ -COPY index.html ./ - -# Copy source files -COPY src ./src -COPY public ./public - -# Copy Tauri configuration -COPY src-tauri ./src-tauri - -# Install frontend dependencies -RUN pnpm install --frozen-lockfile - -# Build the application (RPM package for Fedora) -# Try release build first, fall back to debug if needed -RUN pnpm tauri build --bundles rpm 2>&1 || (echo "Release build failed, trying debug build..." && pnpm tauri build --debug --bundles rpm 2>&1) - -# Create output directory -RUN mkdir -p /app/build-output - -# Copy built artifacts to output directory -# 1. Copy executable binary (release or debug) - check both naming conventions -RUN if [ -f "src-tauri/target/release/quantframe" ]; then \ - cp src-tauri/target/release/quantframe /app/build-output/quantframe && \ - chmod +x /app/build-output/quantframe; \ - elif [ -f "src-tauri/target/release/Quantframe" ]; then \ - cp src-tauri/target/release/Quantframe /app/build-output/quantframe && \ - chmod +x /app/build-output/quantframe; \ - elif [ -f "src-tauri/target/debug/quantframe" ]; then \ - cp src-tauri/target/debug/quantframe /app/build-output/quantframe && \ - chmod +x /app/build-output/quantframe; \ - elif [ -f "src-tauri/target/debug/Quantframe" ]; then \ - cp src-tauri/target/debug/Quantframe /app/build-output/quantframe && \ - chmod +x /app/build-output/quantframe; \ - fi - -# 2. Copy RPM packages -RUN find src-tauri/target -name "*.rpm" -type f -exec cp {} /app/build-output/ \; 2>/dev/null || true - -# 3. Copy any bundle directories (DEB, RPM, etc.) -RUN if [ -d "src-tauri/target/release/bundle" ]; then \ - cp -r src-tauri/target/release/bundle /app/build-output/; \ - elif [ -d "src-tauri/target/debug/bundle" ]; then \ - cp -r src-tauri/target/debug/bundle /app/build-output/; \ - fi - -# List what was copied -RUN echo "=== Build artifacts ===" && \ - ls -lhR /app/build-output/ 2>/dev/null || ls -lh /app/build-output/ && \ - echo "======================" - -# The output will be in /app/build-output/ diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu new file mode 100644 index 00000000..5a6d6eca --- /dev/null +++ b/docker/Dockerfile.ubuntu @@ -0,0 +1,30 @@ +FROM ubuntu:24.04 + +# Install system dependencies for Tauri v2 +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + wget \ + git \ + pkg-config \ + libssl-dev \ + libwebkit2gtk-4.1-dev \ + libappindicator3-dev \ + librsvg2-dev \ + libsoup-3.0-dev \ + libayatana-appindicator3-dev \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Node.js (LTS version) +RUN apt-get update && apt-get install -y nodejs npm && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install pnpm +RUN npm install -g pnpm + +# Install Rust toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +# Set working directory +WORKDIR /app + diff --git a/docker/build-fedora.sh b/docker/build-fedora.sh new file mode 100755 index 00000000..4120894f --- /dev/null +++ b/docker/build-fedora.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" + +# Build the Docker image +echo "Building Docker image (Fedora)..." +docker build -f "$SCRIPT_DIR/Dockerfile.fedora" -t quantframe-react:fedora "$PROJECT_ROOT" + +# Run the container with the project mounted and build inside +echo "Building application in container..." +docker run --rm \ + -v "$PROJECT_ROOT:/app" \ + -v quantframe-cargo-cache:/root/.cargo \ + quantframe-react:fedora \ + bash -c "cd /app && pnpm install --frozen-lockfile && pnpm tauri build --bundles rpm" + +echo "" +echo " - RPM packages: src-tauri/target/release/bundle/rpm/" +echo " - Binary: src-tauri/target/release/" +echo " - Node modules: ./node_modules" +echo " - Rust build cache: ./src-tauri/target" + diff --git a/docker/build-ubuntu.sh b/docker/build-ubuntu.sh new file mode 100755 index 00000000..5a05d969 --- /dev/null +++ b/docker/build-ubuntu.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" + +# Build the Docker image +echo "Building Docker image (Ubuntu)..." +docker build -f "$SCRIPT_DIR/Dockerfile.ubuntu" -t quantframe-react:ubuntu "$PROJECT_ROOT" + +# Run the container with the project mounted and build inside +echo "Building application in container..." +docker run --rm \ + -v "$PROJECT_ROOT:/app" \ + -v quantframe-cargo-cache:/root/.cargo \ + quantframe-react:ubuntu \ + bash -c "cd /app && pnpm install --frozen-lockfile && pnpm tauri build --bundles deb" + +echo "" +echo " - DEB packages: src-tauri/target/release/bundle/deb/" +echo " - Binary: src-tauri/target/release/" +echo " - Node modules: ./node_modules" +echo " - Rust build cache: ./src-tauri/target" + diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100755 index c6a5be9a..00000000 --- a/docker/build.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -e - -# Create build directory -mkdir -p ../build - -# Build the Docker image -echo "Building Docker image..." -docker build -f Dockerfile.fedora -t quantframe-react:build .. - -# Create named volumes for caching (important for Rust compilation) -docker volume create quantframe-build-cache 2>/dev/null || true -docker volume create quantframe-cargo-cache 2>/dev/null || true - -# Create a container with volumes for caching and copy the build output -echo "Extracting build artifacts..." -CONTAINER_ID=$(docker create \ - -v quantframe-build-cache:/app/target \ - -v quantframe-cargo-cache:/root/.cargo \ - quantframe-react:build) - -# Copy all files from build-output directory -docker cp $CONTAINER_ID:/app/build-output/. ../build/ - -# Remove the container -docker rm $CONTAINER_ID - -echo "Build artifacts extracted to ../build/" -echo "Contents:" -ls -lh ../build/ -echo "" -echo "Docker volumes for caching:" -echo " - quantframe-build-cache (Rust target/)" -echo " - quantframe-cargo-cache (Cargo cache)" From 36c7f8c4ca765705baf0c662533ba598261a5f6b Mon Sep 17 00:00:00 2001 From: Katze719 Date: Sun, 25 Jan 2026 21:53:06 +0100 Subject: [PATCH 3/3] Update Ubuntu Dockerfile to include additional dependencies: libseccomp-dev, liblcms2-dev, and libkrb5-dev, while removing libappindicator3-dev. --- docker/Dockerfile.ubuntu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 5a6d6eca..88cb7b73 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -9,10 +9,13 @@ RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libwebkit2gtk-4.1-dev \ - libappindicator3-dev \ librsvg2-dev \ libsoup-3.0-dev \ libayatana-appindicator3-dev \ + libseccomp-dev \ + liblcms2-dev \ + libkrb5-dev \ + patchelf \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install Node.js (LTS version)