FROM node:24-bookworm AS build WORKDIR /workspace RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ build-essential \ curl \ file \ libayatana-appindicator3-dev \ libssl-dev \ libwebkit2gtk-4.1-dev \ libxdo-dev \ patchelf \ pkg-config \ librsvg2-dev \ wget \ && rm -rf /var/lib/apt/lists/* RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal ENV PATH="/root/.cargo/bin:$PATH" ENV CARGO_BUILD_JOBS=1 COPY package.json ./ RUN npm install COPY . . RUN npm run icons RUN cargo test --manifest-path src-tauri/Cargo.toml --lib RUN test -n "$TAURI_SIGNING_PRIVATE_KEY" RUN nice -n 10 npm run bundle:linux RUN set -eux; \ mkdir -p /desktop-artifacts; \ deb="$(find src-tauri/target/release/bundle/deb -maxdepth 1 -type f -name '*.deb' -print -quit)"; \ appimage="$(find src-tauri/target/release/bundle/appimage -maxdepth 1 -type f -name '*.AppImage' -print -quit)"; \ sig="$(find src-tauri/target/release/bundle/appimage -maxdepth 1 -type f -name '*.AppImage.sig' -print -quit)"; \ test -n "$deb"; \ test -n "$appimage"; \ test -n "$sig"; \ cp "$deb" /desktop-artifacts/fieldlens-print-linux-x64.deb; \ cp "$appimage" /desktop-artifacts/fieldlens-print-linux-x64.AppImage; \ cp "$sig" /desktop-artifacts/fieldlens-print-linux-x64.AppImage.sig; \ deb_sha="$(sha256sum /desktop-artifacts/fieldlens-print-linux-x64.deb | awk '{print $1}')"; \ sha256sum /desktop-artifacts/fieldlens-print-linux-x64.deb /desktop-artifacts/fieldlens-print-linux-x64.AppImage > /desktop-artifacts/SHA256SUMS; \ sed -E "s#EXPECTED_SHA256=\"[0-9a-f]{64}\"#EXPECTED_SHA256=\"$deb_sha\"#" downloads/install.sh > /desktop-artifacts/install.sh; \ chmod 0755 /desktop-artifacts/install.sh; \ version="$(node -p "require('./package.json').version")"; \ printf '{\n "version": "%s",\n "notes": "FieldLens Print desktop update",\n "downloads": {\n "linux-x86_64-deb": {\n "url": "https://fieldlens.arrowstack.dev/downloads/fieldlens-print-linux-x64.deb",\n "sha256": "%s"\n }\n }\n}\n' "$version" "$deb_sha" > /desktop-artifacts/release.json FROM nginx:1.27-alpine COPY --from=build /desktop-artifacts /usr/share/nginx/html EXPOSE 80