Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Created October 7, 2024 23:01
Show Gist options
  • Save pythoninthegrass/07a71305df82b1ff46691c37dd5938b1 to your computer and use it in GitHub Desktop.
Save pythoninthegrass/07a71305df82b1ff46691c37dd5938b1 to your computer and use it in GitHub Desktop.
wip docker compose setup of tauri based in part on https://www.the-great.dev/blog/2024-02-04-tauri-docker
services:
build-linux-arm64:
container_name: bonfire-flamekeepr-arm64
build:
context: .
dockerfile: Dockerfile.arm64
platform: linux/arm64/v8
volumes:
- .:/app
working_dir: /app
environment:
TAURI_PRIVATE_KEY: ${TAURI_PRIVATE_KEY:-}
TAURI_KEY_PASSWORD: ${TAURI_KEY_PASSWORD:-}
APPLE_SIGNING_IDENTITY: ${APPLE_SIGNING_IDENTITY:-}
command: "cargo tauri build --target aarch64-unknown-linux-gnu"
volumes:
sccache-data:
# syntax=docker/dockerfile:1.7.0
FROM lukemathwalker/cargo-chef:latest-rust-slim-bookworm AS base
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev\
librsvg2-dev \
&& rm -rf /var/lib/apt/lists/*
RUN cargo install sccache
RUN cargo install tauri-cli
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
FROM base AS planner
COPY ./src-tauri .
RUN rustup target add aarch64-unknown-linux-gnu
RUN cargo chef prepare --recipe-path recipe.json
FROM base AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
cargo tauri build
FROM debian:bookworm-slim AS runner
WORKDIR /app
COPY --from=builder /app/src-tauri/target/release/src-tauri /app/src-tauri
@pythoninthegrass
Copy link
Author

Failed at

warning: [email protected]: 

error: failed to run custom build command for `javascriptcore-rs-sys v1.1.1`

Caused by:
  process didn't exit successfully: `/app/target/release/build/javascriptcore-rs-sys-f6023bf42c2d7876/build-script-build` (exit status: 1)

and based on cursory research, tauri isn't meant to run in docker.

Build times are outrageous even with depot.dev so gonna leave this here for posterity, but likely just use https://github.com/ivangabriele/clamav-desktop/blob/main/Makefile as a jumping off point for a taskfile.

@pythoninthegrass
Copy link
Author

builder 2/4 ... cargo chef cook --release --recipe-path recipe.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment