stort/build.sh

44 lines
1.4 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
IMAGE_NAME="ubuntu:22.04"
HOST_PROJECT_DIR="$PWD"
CONTAINER_PROJECT_DIR="/app"
HOST_OUTPUT_DIR="$PWD/src-tauri/target/release/bundle/appimage"
CONTAINER_OUTPUT_DIR="$CONTAINER_PROJECT_DIR/src-tauri/target/release/bundle/appimage"
USER_ID=$(id -u)
GROUP_ID=$(id -g)
docker pull $IMAGE_NAME
# run the docker image and remove on completion
docker run --rm -it \
-v "$HOST_PROJECT_DIR":$CONTAINER_PROJECT_DIR \
$IMAGE_NAME \
/bin/bash -c "
2024-08-07 15:25:18 +08:00
# update packages
2024-08-07 15:23:09 +08:00
apt update && apt upgrade -y && \
2024-08-07 15:25:18 +08:00
# install tauri dependencies
2024-08-07 15:23:09 +08:00
apt install -y cargo libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev && \
2024-08-07 15:25:18 +08:00
# install mise
install -dm 755 /etc/apt/keyrings && \
wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null && \
echo 'deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main' | tee /etc/apt/sources.list.d/mise.list && \
2024-08-07 15:23:09 +08:00
apt update && \
2024-08-07 15:25:18 +08:00
# install mise tools
2024-08-07 15:23:09 +08:00
apt install -y mise && \
2024-08-07 15:25:18 +08:00
# build
cd $CONTAINER_PROJECT_DIR && \
mise install && \
mise settings set experimental true && \
mise exec bun --command \"bun run tauri build\"
2024-08-07 15:04:05 +08:00
chown -R $USER_ID:$GROUP_ID $CONTAINER_PROJECT_DIR && \
2024-08-07 15:04:05 +08:00
echo "Build complete. Output available in $HOST_OUTPUT_DIR"
"