vibetunnel/tauri/Dockerfile.linux

51 lines
No EOL
1.2 KiB
Docker

# Dockerfile for building Linux binaries
FROM rust:latest
# Install required dependencies for Tauri
RUN apt-get update && apt-get install -y \
libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libpam0g-dev \
&& 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
# 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 Linux
WORKDIR /app/web
RUN pnpm install --frozen-lockfile && pnpm rebuild
# Go back to main directory
WORKDIR /app
# Build the Linux binary
CMD ["cargo", "tauri", "build"]