Skip to content

Commit

Permalink
Merge pull request #74 from logicalclocks/release-0.5
Browse files Browse the repository at this point in the history
RONDB-665: Merge 0.5 upstream
  • Loading branch information
olapiv authored May 29, 2024
2 parents ebb973c + cece403 commit bbbfd87
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
--tag rondb-standalone:$RONDB_VERSION_STABLE-$VERSION \
--build-arg RONDB_VERSION=$RONDB_VERSION_STABLE \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \
--build-arg RONDB_TARBALL_URI=$BASE_DEPLOY_URL/$STABLE_X86_TARBALL_NAME
--build-arg RONDB_X86_TARBALL_URI=$BASE_DEPLOY_URL/$STABLE_X86_TARBALL_NAME
# In the main branch, we work with "<version>-SNAPSHOT", which might as well be called "latest"
- name: Push X86 *latest* images to Dockerhub
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
--output type=registry \
--build-arg RONDB_VERSION=$RONDB_VERSION_LTS \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \
--build-arg RONDB_TARBALL_URI=$BASE_DEPLOY_URL/$LTS_ARM_TARBALL_NAME \
--build-arg RONDB_ARM_TARBALL_URI=$BASE_DEPLOY_URL/$LTS_ARM_TARBALL_NAME \
--cache-to type=registry,ref=hopsworks/rondb-standalone-cache,mode=max \
--cache-from type=registry,ref=hopsworks/rondb-standalone-cache,mode=max
Expand All @@ -180,7 +180,7 @@ jobs:
--output type=registry \
--build-arg RONDB_VERSION=$RONDB_VERSION_STABLE \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \
--build-arg RONDB_TARBALL_URI=$BASE_DEPLOY_URL/$STABLE_ARM_TARBALL_NAME \
--build-arg RONDB_ARM_TARBALL_URI=$BASE_DEPLOY_URL/$STABLE_ARM_TARBALL_NAME \
--cache-to type=registry,ref=hopsworks/rondb-standalone-cache,mode=max \
--cache-from type=registry,ref=hopsworks/rondb-standalone-cache,mode=max
Expand Down
29 changes: 24 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ARG TARGETVARIANT
RUN echo "Running on $BUILDPLATFORM, building for $TARGETPLATFORM"
RUN echo "TARGETARCH: $TARGETARCH; TARGETVARIANT: $TARGETVARIANT"

# Fail the build if TARGETARCH is not arm64 or amd64
RUN if [ "$TARGETARCH" != "arm64" ] && [ "$TARGETARCH" != "amd64" ]; then \
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
fi

RUN --mount=type=cache,target=/var/cache/apt,id=ubuntu22-apt-$TARGETPLATFORM \
--mount=type=cache,target=/var/lib/apt/lists,id=ubuntu22-apt-lists-$TARGETPLATFORM \
apt-get update -y \
Expand Down Expand Up @@ -49,15 +54,29 @@ RUN mkdir -p $RONDB_BIN_DIR

# Get RonDB tarball from local path & unpack it
FROM cloud_preparation as local_tarball
ARG RONDB_TARBALL_URI
RUN --mount=type=bind,source=$RONDB_TARBALL_URI,target=$RONDB_TARBALL_URI \
tar xfz $RONDB_TARBALL_URI -C $RONDB_BIN_DIR --strip-components=1 \
ARG RONDB_X86_TARBALL_URI
ARG RONDB_ARM_TARBALL_URI

RUN case "$TARGETARCH" in \
amd64) echo "export TARBALL_PATH=$RONDB_X86_TARBALL_URI" >> /env.sh;; \
arm64) echo "export TARBALL_PATH=$RONDB_ARM_TARBALL_URI" >> /env.sh;; \
esac

RUN --mount=type=bind,source=.,target=/context \
. /env.sh \
&& tar xfz /context/${TARBALL_PATH} -C $RONDB_BIN_DIR --strip-components=1 \
&& chown mysql:mysql -R $RONDB_BIN_DIR

# Get RonDB tarball from remote url & unpack it
FROM cloud_preparation as remote_tarball
ARG RONDB_TARBALL_URI
RUN wget $RONDB_TARBALL_URI -O ./temp_tarball.tar.gz \
ARG RONDB_X86_TARBALL_URI
ARG RONDB_ARM_TARBALL_URI

RUN case "$TARGETARCH" in \
amd64) TARBALL_URL=$RONDB_X86_TARBALL_URI;; \
arm64) TARBALL_URL=$RONDB_ARM_TARBALL_URI;; \
esac \
&& wget $TARBALL_URL -O ./temp_tarball.tar.gz \
&& tar xfz ./temp_tarball.tar.gz -C $RONDB_BIN_DIR --strip-components=1 \
&& rm ./temp_tarball.tar.gz \
&& chown mysql:mysql -R $RONDB_BIN_DIR
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ Commands to run:
--num-rest-api-nodes 1 \
--num-benchmarking-nodes 1

# Build cross-platform image (linux/arm64 here)
docker buildx build . --platform=linux/arm64 -t rondb-standalone:21.04.16 \
# Build multi-platform image
docker buildx build . --platform=linux/arm64,linux/amd64 \
-t rondb-standalone:21.04.16 \
--build-arg RONDB_VERSION=21.04.16 \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \ # alternatively "local"
--build-arg RONDB_TARBALL_URI=https://repo.hops.works/master/rondb-21.04.16-linux-glibc2.35-arm64_v8.tar.gz # alternatively a local file path
--build-arg RONDB_X86_TARBALL_URI=https://repo.hops.works/master/rondb-21.04.16-linux-glibc2.28-x86_64.tar.gz \ # alternatively a local file path
--build-arg RONDB_ARM_TARBALL_URI=https://repo.hops.works/master/rondb-21.04.16-linux-glibc2.35-arm64_v8.tar.gz

# Explore image
docker run --rm -it --entrypoint=/bin/bash rondb-standalone:21.04.16
Expand Down
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
RONDB_IMAGE_NAME=rondb-standalone:22.10.3
RONDB_VERSION=22.10.3
RONDB_TARBALL_URI=https://repo.hops.works/master/rondb-22.10.3-linux-glibc2.28-arm64_v8.tar.gz

docker buildx build . \
--tag $RONDB_IMAGE_NAME \
--build-arg RONDB_VERSION=$RONDB_VERSION-$VERSION \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \
--build-arg RONDB_ARM_TARBALL_URI=$RONDB_TARBALL_URI
4 changes: 3 additions & 1 deletion build_run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,13 @@ else
RONDB_TARBALL_LOCAL_REMOTE=local
fi

# We're not using this for cross-platform builds, so can use same argument twice
docker buildx build . \
--tag $RONDB_IMAGE_NAME \
--build-arg RONDB_VERSION=$RONDB_VERSION \
--build-arg RONDB_TARBALL_LOCAL_REMOTE=$RONDB_TARBALL_LOCAL_REMOTE \
--build-arg RONDB_TARBALL_URI=$RONDB_TARBALL_URI
--build-arg RONDB_X86_TARBALL_URI=$RONDB_TARBALL_URI \
--build-arg RONDB_ARM_TARBALL_URI=$RONDB_TARBALL_URI
fi

#######################
Expand Down

0 comments on commit bbbfd87

Please sign in to comment.