From 89db2b3155650d19c211aa6e52801a51384c41df Mon Sep 17 00:00:00 2001 From: oxypomme Date: Mon, 12 Feb 2024 17:22:57 +0100 Subject: [PATCH] refactor: using more advanced scripts for more customization --- .gitignore | 1 + ubuntu20-04/build-i3lock.sh | 4 ---- ubuntu20-04/build-ugrep.dockerfile | 21 ------------------- ubuntu20-04/build-ugrep.sh | 8 ------- .../Dockerfile} | 8 +------ ubuntu20-04/i3lock/build.sh | 13 ++++++++++++ ubuntu20-04/ugrep/Dockerfile | 12 +++++++++++ ubuntu20-04/ugrep/build.sh | 17 +++++++++++++++ 8 files changed, 44 insertions(+), 40 deletions(-) create mode 100644 .gitignore delete mode 100755 ubuntu20-04/build-i3lock.sh delete mode 100644 ubuntu20-04/build-ugrep.dockerfile delete mode 100755 ubuntu20-04/build-ugrep.sh rename ubuntu20-04/{build-i3lock.dockerfile => i3lock/Dockerfile} (57%) create mode 100755 ubuntu20-04/i3lock/build.sh create mode 100644 ubuntu20-04/ugrep/Dockerfile create mode 100755 ubuntu20-04/ugrep/build.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c036379 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp/ \ No newline at end of file diff --git a/ubuntu20-04/build-i3lock.sh b/ubuntu20-04/build-i3lock.sh deleted file mode 100755 index 10fd29a..0000000 --- a/ubuntu20-04/build-i3lock.sh +++ /dev/null @@ -1,4 +0,0 @@ -docker build -f build-i3lock.dockerfile --no-cache -t build-i3lock:latest . -docker run -d --name build-i3lock build-i3lock:latest -docker cp build-i3lock:/build/i3lock-color/build/i3lock ~/bin/i3lock -docker remove -f build-i3lock diff --git a/ubuntu20-04/build-ugrep.dockerfile b/ubuntu20-04/build-ugrep.dockerfile deleted file mode 100644 index 87efa6f..0000000 --- a/ubuntu20-04/build-ugrep.dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -# step 1: create a container for ugrep named "ugrep" -# docker -D build --no-cache -t ugrep . -# -# step 2: run bash in the container, e.g. to run ugrep from the command line -# docker run -it ugrep bash -# -# step 3: run ugrep in the container, for example: -# ugrep -r -n -tjava Hello ugrep/tests/ - -FROM ubuntu:20.04 - -WORKDIR /build/ugrep - -RUN apt-get update \ - && apt-get install -y make vim git clang wget unzip libpcre2-dev libz-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev - -RUN git clone https://github.com/Genivia/ugrep /build/ugrep - -RUN ./build.sh - -CMD ["sleep", "infinity"] \ No newline at end of file diff --git a/ubuntu20-04/build-ugrep.sh b/ubuntu20-04/build-ugrep.sh deleted file mode 100755 index 868b3a1..0000000 --- a/ubuntu20-04/build-ugrep.sh +++ /dev/null @@ -1,8 +0,0 @@ -docker build -f build-ugrep.dockerfile --no-cache -t build-ugrep:latest . -docker run -d --name build-ugrep build-ugrep:latest -docker cp build-ugrep:/build/ugrep/bin/ugrep ~/bin/ugrep -docker cp build-ugrep:/build/ugrep/bin/ug ~/bin/ug -sudo docker cp build-ugrep:/build/ugrep/patterns/. /usr/local/share/ugrep/patterns/ -sudo docker cp build-ugrep:/build/ugrep/man/ugrep.1 /tmp/ugrep.1 -sudo /usr/bin/install -c -m 644 /tmp/ugrep.1 '/usr/local/share/man/man1' -docker remove -f build-ugrep diff --git a/ubuntu20-04/build-i3lock.dockerfile b/ubuntu20-04/i3lock/Dockerfile similarity index 57% rename from ubuntu20-04/build-i3lock.dockerfile rename to ubuntu20-04/i3lock/Dockerfile index b053be1..cecf680 100644 --- a/ubuntu20-04/build-i3lock.dockerfile +++ b/ubuntu20-04/i3lock/Dockerfile @@ -1,9 +1,3 @@ -# step 1: create a container for i3lock named "i3lock" -# docker -D build --no-cache -t i3lock . -# -# step 2: run bash in the container, e.g. to run i3lock from the command line -# docker run -it i3lock bash - FROM ubuntu:20.04 WORKDIR /build/i3lock-color @@ -13,7 +7,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y git autoconf gcc make pkg-config libpam0g-dev libcairo2-dev libfontconfig1-dev libxcb-composite0-dev libev-dev libx11-xcb-dev libxcb-xkb-dev libxcb-xinerama0-dev libxcb-randr0-dev libxcb-image0-dev libxcb-util-dev libxcb-xrm-dev libxkbcommon-dev libxkbcommon-x11-dev libjpeg-dev -RUN git clone https://github.com/Raymo111/i3lock-color.git /build/i3lock-color +RUN git clone --depth=1 https://github.com/Raymo111/i3lock-color.git /build/i3lock-color RUN ./build.sh diff --git a/ubuntu20-04/i3lock/build.sh b/ubuntu20-04/i3lock/build.sh new file mode 100755 index 0000000..eb48db6 --- /dev/null +++ b/ubuntu20-04/i3lock/build.sh @@ -0,0 +1,13 @@ +APP=i3lock + +CONTAINER="build-${APP}" +ROOT="/build/${APP}-color" +IMAGE="${CONTAINER}:latest" +TARGET="~/bin" + +docker build -t "${IMAGE}" "${APP}" +docker run -d --name "${CONTAINER}" "${IMAGE}" + +docker cp "${CONTAINER}:${ROOT}/build/i3lock" "${TARGET}/i3lock" + +docker remove -f "${CONTAINER}" diff --git a/ubuntu20-04/ugrep/Dockerfile b/ubuntu20-04/ugrep/Dockerfile new file mode 100644 index 0000000..82b2c9c --- /dev/null +++ b/ubuntu20-04/ugrep/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:20.04 + +WORKDIR /build/ugrep + +RUN apt-get update \ + && apt-get install -y make vim git clang wget unzip libpcre2-dev libz-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev + +RUN git clone --depth=1 https://github.com/Genivia/ugrep /build/ugrep + +RUN ./build.sh + +CMD ["sleep", "infinity"] \ No newline at end of file diff --git a/ubuntu20-04/ugrep/build.sh b/ubuntu20-04/ugrep/build.sh new file mode 100755 index 0000000..d35f466 --- /dev/null +++ b/ubuntu20-04/ugrep/build.sh @@ -0,0 +1,17 @@ +APP=ugrep + +CONTAINER="build-${APP}" +ROOT="/build/${APP}" +IMAGE="${CONTAINER}:latest" +TARGET="~/bin" + +docker build -t "${IMAGE}" "${APP}" +docker run -d --name "${CONTAINER}" "${IMAGE}" + +docker cp "${CONTAINER}:${ROOT}/bin/ugrep" "${TARGET}/ugrep" +docker cp "${CONTAINER}:${ROOT}/bin/ug" "${TARGET}/ug" +sudo docker cp "${CONTAINER}:${ROOT}/patterns/." /usr/local/share/ugrep/patterns/ +sudo docker cp "${CONTAINER}:${ROOT}/man/ugrep.1" /tmp/ugrep.1 +sudo /usr/bin/install -c -m 644 /tmp/ugrep.1 '/usr/local/share/man/man1' + +docker remove -f "${CONTAINER}"