From ca1e98ad94ae1374fb2a1f5b4512fb6578c7f97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Budiseli=C4=87?= Date: Sat, 22 Jul 2023 18:00:38 +0200 Subject: [PATCH] Add package/release/run.sh build (#1060) * Optimize `memgraph/memgraph-builder` (on Dockerhub) image size * Optimize `mgbuild_{{ os }}` (under CI) image size --- release/package/amzn-2/Dockerfile | 3 ++- release/package/centos-7/Dockerfile | 3 ++- release/package/centos-9/Dockerfile | 3 ++- release/package/debian-10/Dockerfile | 3 ++- release/package/debian-11-arm/Dockerfile | 3 ++- release/package/debian-11/Dockerfile | 3 ++- release/package/fedora-36/Dockerfile | 3 ++- release/package/run.sh | 13 +++++++++++++ release/package/ubuntu-18.04/Dockerfile | 3 ++- release/package/ubuntu-20.04/Dockerfile | 3 ++- release/package/ubuntu-22.04-arm/Dockerfile | 3 ++- release/package/ubuntu-22.04/Dockerfile | 3 ++- 12 files changed, 35 insertions(+), 11 deletions(-) diff --git a/release/package/amzn-2/Dockerfile b/release/package/amzn-2/Dockerfile index 3bcc8ad72..ba3ad34b9 100644 --- a/release/package/amzn-2/Dockerfile +++ b/release/package/amzn-2/Dockerfile @@ -9,6 +9,7 @@ RUN yum -y update \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-amzn-2-x86_64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/centos-7/Dockerfile b/release/package/centos-7/Dockerfile index 11778a179..ff386c551 100644 --- a/release/package/centos-7/Dockerfile +++ b/release/package/centos-7/Dockerfile @@ -9,6 +9,7 @@ RUN yum -y update \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-centos-7-x86_64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/centos-9/Dockerfile b/release/package/centos-9/Dockerfile index 87c8f8b02..1c4c9541e 100644 --- a/release/package/centos-9/Dockerfile +++ b/release/package/centos-9/Dockerfile @@ -9,6 +9,7 @@ RUN yum -y update \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-centos-9-x86_64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/debian-10/Dockerfile b/release/package/debian-10/Dockerfile index a1519f04b..abd4a7f0e 100644 --- a/release/package/debian-10/Dockerfile +++ b/release/package/debian-10/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/debian-11-arm/Dockerfile b/release/package/debian-11-arm/Dockerfile index 243a527ad..5040d8041 100644 --- a/release/package/debian-11-arm/Dockerfile +++ b/release/package/debian-11-arm/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-debian-11-arm64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/debian-11/Dockerfile b/release/package/debian-11/Dockerfile index f28c32e89..cf47f253e 100644 --- a/release/package/debian-11/Dockerfile +++ b/release/package/debian-11/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-debian-11-amd64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/fedora-36/Dockerfile b/release/package/fedora-36/Dockerfile index 8e2f8a6fe..f84af132f 100644 --- a/release/package/fedora-36/Dockerfile +++ b/release/package/fedora-36/Dockerfile @@ -10,6 +10,7 @@ RUN yum -y update \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-fedora-36-x86_64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/run.sh b/release/package/run.sh index baaca8f34..1e9395c50 100755 --- a/release/package/run.sh +++ b/release/package/run.sh @@ -159,6 +159,19 @@ case "$1" in fi ;; + build) + shift 1 + if [[ "$#" -ne 2 ]]; then + print_help + fi + # in the vX format, e.g. v5 + toolchain_version="$1" + # a name of the os folder, e.g. ubuntu-22.04-arm + os="$2" + cd "$SCRIPT_DIR/$os" + docker build -f Dockerfile --build-arg TOOLCHAIN_VERSION="toolchain-$toolchain_version" -t "memgraph/memgraph-builder:${toolchain_version}_$os" . + ;; + test) echo "TODO(gitbuda): Test all packages on mgtest containers." ;; diff --git a/release/package/ubuntu-18.04/Dockerfile b/release/package/ubuntu-18.04/Dockerfile index c2b1d8d50..97eceead4 100644 --- a/release/package/ubuntu-18.04/Dockerfile +++ b/release/package/ubuntu-18.04/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-ubuntu-18.04-amd64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/ubuntu-20.04/Dockerfile b/release/package/ubuntu-20.04/Dockerfile index ffcd67384..9fea7fd79 100644 --- a/release/package/ubuntu-20.04/Dockerfile +++ b/release/package/ubuntu-20.04/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-ubuntu-20.04-amd64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/ubuntu-22.04-arm/Dockerfile b/release/package/ubuntu-22.04-arm/Dockerfile index 5ddb94883..56cac8f76 100644 --- a/release/package/ubuntu-22.04-arm/Dockerfile +++ b/release/package/ubuntu-22.04-arm/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz -C /opt \ + && rm ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-arm64.tar.gz ENTRYPOINT ["sleep", "infinity"] diff --git a/release/package/ubuntu-22.04/Dockerfile b/release/package/ubuntu-22.04/Dockerfile index 86b4648fc..f08f364cf 100644 --- a/release/package/ubuntu-22.04/Dockerfile +++ b/release/package/ubuntu-22.04/Dockerfile @@ -12,6 +12,7 @@ RUN apt update && apt install -y \ RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz \ -O ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz \ - && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz -C /opt + && tar xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz -C /opt \ + && rm xzvf ${TOOLCHAIN_VERSION}-binaries-ubuntu-22.04-amd64.tar.gz ENTRYPOINT ["sleep", "infinity"]