#!/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 "
    
    # update packages
    apt update && apt install curl -y && \

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
    echo $HOME && \
    source "/root/.cargo/env" && \
    cargo --version
    "
