vibetunnel/tauri/Dockerfile.windows

48 lines
No EOL
1.2 KiB
Docker

# Dockerfile for building Windows binaries
FROM rust:latest
# Install Windows cross-compilation tools
RUN apt-get update && apt-get install -y \
mingw-w64 \
nsis \
wine64 \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
# Install pnpm
RUN npm install -g pnpm
# Install nightly toolchain for edition2024 support
RUN rustup toolchain install nightly && \
rustup default nightly
# Add Windows target
RUN rustup target add x86_64-pc-windows-gnu
# Set environment variable to enable edition2024
ENV CARGO_UNSTABLE_EDITION2024=true
# Install latest tauri-cli
RUN cargo install tauri-cli --locked
# Set working directory
WORKDIR /app
# Copy the entire project
COPY . .
# Remove any existing node_modules to avoid platform conflicts
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' + || true
# Install web dependencies and rebuild native modules for Windows target
WORKDIR /app/web
RUN pnpm install --frozen-lockfile && pnpm rebuild
# Go back to main directory
WORKDIR /app
# Build the Windows binary
CMD ["cargo", "tauri", "build", "--target", "x86_64-pc-windows-gnu"]