From fbe9b91006c43bd1626149ccac0da06e6d7de795 Mon Sep 17 00:00:00 2001 From: Jaby Date: Thu, 2 Jan 2025 21:42:31 +0100 Subject: [PATCH] Update Dockerfile to be less painful; Set JABY_ENGINE_PATH automatically --- podman/Dockerfile | 15 ++++++++++++--- podman/install.sh | 14 +++++++++++++- podman/scripts/install_rust.sh | 3 +++ podman/scripts/make_gcc.sh | 3 +++ podman/scripts/prerequisites.sh | 3 --- readme.md | 1 + 6 files changed, 32 insertions(+), 7 deletions(-) delete mode 100755 podman/scripts/prerequisites.sh diff --git a/podman/Dockerfile b/podman/Dockerfile index 40a6fc8a..01641870 100644 --- a/podman/Dockerfile +++ b/podman/Dockerfile @@ -1,8 +1,16 @@ FROM "ubuntu:24.04" -ADD ["scripts/install_pop-fe.sh", "scripts/install_rust.sh", "scripts/make_gcc.sh", "scripts/prerequisites.sh", "/usr/scripts"] -RUN apt update && cd /usr/scripts && ./prerequisites.sh && ./install_rust.sh && cd /usr && ./scripts/make_gcc.sh +WORKDIR /usr +ADD ["scripts/make_gcc.sh", "/usr/scripts"] +RUN apt update && /usr/scripts/make_gcc.sh +WORKDIR /usr/scripts +ADD ["scripts/install_rust.sh", "/usr/scripts"] +RUN apt update && ./install_rust.sh +# TODO: Deal with this eventually +ADD ["scripts/install_pop-fe.sh", "/usr/scripts"] + +#WORKDIR /usr/src/project #RUN apt update && apt install -y nginx @@ -13,4 +21,5 @@ RUN apt update && cd /usr/scripts && ./prerequisites.sh && ./install_rust.sh && #ADD install_pop-fe.sh install_pop-fe.sh #CMD ["cp", "install_pop-fe.sh", "/my_vol"] -# TODO: Make a script that builds the image and then registers alias like `jaby-make` for the docker command \ No newline at end of file + +# TODO: Make a script that builds the image and --then registers alias like `jaby-make` for the docker command-- Cody said alias are bad (yesterday he liked them) and wants scripts instead (He also suddenly claims that he called them invasive but ACTUALLY it was me. Oh noooow he corrects his statement) \ No newline at end of file diff --git a/podman/install.sh b/podman/install.sh index 2d0552c6..73f40ff9 100755 --- a/podman/install.sh +++ b/podman/install.sh @@ -1 +1,13 @@ -podman build -t jaby_engine . \ No newline at end of file +#!/usr/bin/env bash +podman build -t jaby_engine . + +if [[ -z "${JABY_ENGINE_PATH}" ]]; then +echo "Setting JABY_ENGINE_PATH to parent folder" + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +JABY_ENGINE_PATH="$(dirname "$SCRIPT_DIR")" +cat << End >> ~/.profile +export JABY_ENGINE_PATH="$JABY_ENGINE_PATH" +End +source ~/.profile +fi \ No newline at end of file diff --git a/podman/scripts/install_rust.sh b/podman/scripts/install_rust.sh index f01bbb2d..0c4136c6 100755 --- a/podman/scripts/install_rust.sh +++ b/podman/scripts/install_rust.sh @@ -1,4 +1,7 @@ #!/bin/bash +echo "<<< Install Rust prerequisites >>>" +apt install -y curl + echo "<<< Install Rust >>>" curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y . "$HOME/.cargo/env" diff --git a/podman/scripts/make_gcc.sh b/podman/scripts/make_gcc.sh index 24b5ec72..18f31835 100755 --- a/podman/scripts/make_gcc.sh +++ b/podman/scripts/make_gcc.sh @@ -1,4 +1,7 @@ #!/bin/bash +echo "<<< Install GCC prerequisites >>>" +apt install -y make texinfo g++ gcc git libgmp3-dev libmpfr-dev libmpc-dev flex install-info info bison + GCC_VERSION=13.1.0 echo "<<< Build GCC >>>" diff --git a/podman/scripts/prerequisites.sh b/podman/scripts/prerequisites.sh deleted file mode 100755 index 5fdafe98..00000000 --- a/podman/scripts/prerequisites.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo "<<< Install prerequisites >>>" -apt install -y curl make texinfo g++ gcc git libgmp3-dev libmpfr-dev libmpc-dev flex install-info info bison \ No newline at end of file diff --git a/readme.md b/readme.md index 58f364d9..71bdd714 100644 --- a/readme.md +++ b/readme.md @@ -23,6 +23,7 @@ JabyEngine is my personal attempt to eventually make my own PS1 game from "groun * `podman run -it /bin/bash`: runs bash and interactive * `podman run --rm <-v : <-e ENV_VAR=VALUE> jaby_engine`: clean up after run * `podman image tree `: lists usefull information +* `podman run --rm -it -v ${JABY_ENGINE_PATH}:${JABY_ENGINE_PATH} jaby_engine /bin/bash` maybe a good idea...? ## How to build JabyEngine relies on linux to be build. For Windows users it uses `wsl` instead but support for it might get dropped during further development.