feat: Build-Script + Docker-Build fuer alle Plattformen
build.sh - baut Clients via Docker (kein lokales Setup noetig): ./build.sh linux # Linux Desktop (.deb + .AppImage) ./build.sh windows # Windows Desktop (.msi + .exe) Cross-Compile ./build.sh mac # macOS Desktop (.dmg) - nur auf macOS ./build.sh android # Android App (.apk) via Docker ./build.sh ios # iOS App (.ipa) - nur auf macOS ./build.sh all-desktop # Linux + Windows zusammen ./build.sh clean # Build-Cache loeschen Dockerfile.build: Multi-stage Container mit Rust, Node.js, Tauri-Deps, Windows Cross-Compile Tools (mingw-w64) Output landet in build-output/ (gitignored) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
06ad65dbb3
commit
48a46cbc79
|
|
@ -0,0 +1,176 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Mini-Cloud Client Build Script
|
||||
# Baut Desktop- und Mobile-Clients via Docker (kein lokales Setup noetig)
|
||||
#
|
||||
# Verwendung:
|
||||
# ./build.sh linux # Linux Desktop (.deb + .AppImage)
|
||||
# ./build.sh windows # Windows Desktop (.msi + .exe)
|
||||
# ./build.sh mac # macOS Desktop (.dmg) - nur auf macOS moeglich
|
||||
# ./build.sh android # Android App (.apk)
|
||||
# ./build.sh ios # iOS App (.ipa) - nur auf macOS moeglich
|
||||
# ./build.sh all-desktop # Linux + Windows
|
||||
# ./build.sh clean # Build-Cache loeschen
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
DESKTOP_DIR="$SCRIPT_DIR/clients/desktop"
|
||||
MOBILE_DIR="$SCRIPT_DIR/clients/mobile"
|
||||
OUTPUT_DIR="$SCRIPT_DIR/build-output"
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
info() { echo -e "${GREEN}[BUILD]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
build_linux() {
|
||||
info "Baue Linux Desktop Client..."
|
||||
cd "$DESKTOP_DIR"
|
||||
|
||||
docker build -f Dockerfile.build -t minicloud-desktop-builder .
|
||||
|
||||
docker run --rm \
|
||||
-v "$OUTPUT_DIR:/output" \
|
||||
minicloud-desktop-builder \
|
||||
bash -c "npm run tauri build && cp -r src-tauri/target/release/bundle/* /output/ 2>/dev/null; \
|
||||
cp src-tauri/target/release/minicloud-sync /output/ 2>/dev/null; \
|
||||
echo 'Linux Build fertig!'"
|
||||
|
||||
info "Linux Build fertig! Dateien in: $OUTPUT_DIR/"
|
||||
}
|
||||
|
||||
build_windows() {
|
||||
info "Baue Windows Desktop Client (Cross-Compile)..."
|
||||
cd "$DESKTOP_DIR"
|
||||
|
||||
docker build -f Dockerfile.build -t minicloud-desktop-builder .
|
||||
|
||||
docker run --rm \
|
||||
-v "$OUTPUT_DIR:/output" \
|
||||
-e CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
|
||||
minicloud-desktop-builder \
|
||||
bash -c "npm run tauri build -- --target x86_64-pc-windows-gnu 2>&1 || true; \
|
||||
find src-tauri/target -name '*.exe' -o -name '*.msi' | head -5; \
|
||||
cp src-tauri/target/x86_64-pc-windows-gnu/release/*.exe /output/ 2>/dev/null; \
|
||||
cp -r src-tauri/target/x86_64-pc-windows-gnu/release/bundle/* /output/ 2>/dev/null; \
|
||||
echo 'Windows Build fertig!'"
|
||||
|
||||
info "Windows Build fertig! Dateien in: $OUTPUT_DIR/"
|
||||
}
|
||||
|
||||
build_mac() {
|
||||
# macOS kann nicht cross-compiled werden, muss auf macOS laufen
|
||||
if [[ "$(uname)" != "Darwin" ]]; then
|
||||
error "macOS Build ist nur auf macOS moeglich!"
|
||||
fi
|
||||
|
||||
info "Baue macOS Desktop Client..."
|
||||
cd "$DESKTOP_DIR"
|
||||
npm install
|
||||
npm run tauri build
|
||||
|
||||
cp -r src-tauri/target/release/bundle/* "$OUTPUT_DIR/" 2>/dev/null
|
||||
info "macOS Build fertig! Dateien in: $OUTPUT_DIR/"
|
||||
}
|
||||
|
||||
build_android() {
|
||||
if [ ! -d "$MOBILE_DIR" ]; then
|
||||
error "Mobile Client noch nicht erstellt (clients/mobile/)"
|
||||
fi
|
||||
|
||||
info "Baue Android App..."
|
||||
cd "$MOBILE_DIR"
|
||||
|
||||
docker run --rm \
|
||||
-v "$MOBILE_DIR:/app" \
|
||||
-v "$OUTPUT_DIR:/output" \
|
||||
ghcr.io/nickvdyck/flutter-android:latest \
|
||||
bash -c "cd /app && flutter pub get && flutter build apk --release && \
|
||||
cp build/app/outputs/flutter-apk/app-release.apk /output/minicloud.apk && \
|
||||
echo 'Android Build fertig!'"
|
||||
|
||||
info "Android APK: $OUTPUT_DIR/minicloud.apk"
|
||||
}
|
||||
|
||||
build_ios() {
|
||||
if [[ "$(uname)" != "Darwin" ]]; then
|
||||
error "iOS Build ist nur auf macOS moeglich!"
|
||||
fi
|
||||
|
||||
if [ ! -d "$MOBILE_DIR" ]; then
|
||||
error "Mobile Client noch nicht erstellt (clients/mobile/)"
|
||||
fi
|
||||
|
||||
info "Baue iOS App..."
|
||||
cd "$MOBILE_DIR"
|
||||
flutter pub get
|
||||
flutter build ios --release
|
||||
|
||||
info "iOS Build fertig! Oeffne Xcode fuer Signierung + Archive."
|
||||
}
|
||||
|
||||
do_clean() {
|
||||
info "Loesche Build-Cache..."
|
||||
rm -rf "$OUTPUT_DIR"/*
|
||||
rm -rf "$DESKTOP_DIR/src-tauri/target"
|
||||
rm -rf "$MOBILE_DIR/build" 2>/dev/null
|
||||
docker rmi minicloud-desktop-builder 2>/dev/null || true
|
||||
info "Build-Cache geloescht."
|
||||
}
|
||||
|
||||
# Main
|
||||
case "${1:-help}" in
|
||||
linux)
|
||||
build_linux
|
||||
;;
|
||||
windows)
|
||||
build_windows
|
||||
;;
|
||||
mac|macos)
|
||||
build_mac
|
||||
;;
|
||||
android)
|
||||
build_android
|
||||
;;
|
||||
ios)
|
||||
build_ios
|
||||
;;
|
||||
all-desktop)
|
||||
build_linux
|
||||
build_windows
|
||||
;;
|
||||
clean)
|
||||
do_clean
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
echo "Mini-Cloud Client Build Script"
|
||||
echo ""
|
||||
echo "Verwendung: $0 <ziel>"
|
||||
echo ""
|
||||
echo "Desktop:"
|
||||
echo " linux Linux (.deb + .AppImage + Binary)"
|
||||
echo " windows Windows (.msi + .exe) - Cross-Compile via Docker"
|
||||
echo " mac macOS (.dmg) - nur auf macOS"
|
||||
echo " all-desktop Linux + Windows"
|
||||
echo ""
|
||||
echo "Mobile:"
|
||||
echo " android Android (.apk) - via Docker"
|
||||
echo " ios iOS (.ipa) - nur auf macOS"
|
||||
echo ""
|
||||
echo "Sonstiges:"
|
||||
echo " clean Build-Cache loeschen"
|
||||
echo ""
|
||||
echo "Alle Builds (ausser mac/ios) laufen in Docker - kein lokales"
|
||||
echo "Setup noetig. Output landet in: build-output/"
|
||||
echo ""
|
||||
;;
|
||||
esac
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
# Multi-stage build container for Tauri Desktop Client
|
||||
# Supports: linux, windows (cross-compile)
|
||||
|
||||
FROM rust:1.94-bookworm AS builder
|
||||
|
||||
# Install system dependencies for Tauri
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
libgtk-3-dev \
|
||||
libayatana-appindicator3-dev \
|
||||
librsvg2-dev \
|
||||
libcairo2-dev \
|
||||
libgdk-pixbuf-2.0-dev \
|
||||
libsoup-3.0-dev \
|
||||
libjavascriptcoregtk-4.1-dev \
|
||||
pkg-config \
|
||||
curl \
|
||||
wget \
|
||||
file \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Node.js
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Windows cross-compile tools
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc-mingw-w64-x86-64 \
|
||||
nsis \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rustup target add x86_64-pc-windows-gnu || true
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Cache Rust dependencies
|
||||
COPY src-tauri/Cargo.toml src-tauri/Cargo.lock* ./src-tauri/
|
||||
COPY src-tauri/build.rs ./src-tauri/
|
||||
RUN mkdir -p src-tauri/src && echo "pub fn run() {}" > src-tauri/src/lib.rs \
|
||||
&& echo "fn main() { minicloud_sync_lib::run() }" > src-tauri/src/main.rs \
|
||||
&& cd src-tauri && cargo fetch 2>/dev/null || true
|
||||
|
||||
# Copy full source
|
||||
COPY . .
|
||||
|
||||
# Install npm dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Default: build for linux
|
||||
CMD ["npm", "run", "tauri", "build"]
|
||||
Loading…
Reference in New Issue