Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#673] feat(CI): Gravitino Docker image (#833)

Xun Liu36387fb84c9c
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 2d461508dd..69e5cedeba 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -7,8 +7,9 @@ on:
type: choice
description: 'Choose the image to build'
required: true
- default: 'gravitino-ci-hive'
+ default: 'gravitino'
options:
+ - 'gravitino'
- 'gravitino-ci-hive'
- 'gravitino-ci-trino'
tag:
@@ -36,10 +37,11 @@ jobs:
elif [ "${{ github.event.inputs.image }}" == "gravitino-ci-trino" ]; then
echo "image_type=trino" >> $GITHUB_ENV
echo "image_name=datastrato/gravitino-ci-trino" >> $GITHUB_ENV
+ elif [ "${{ github.event.inputs.image }}" == "gravitino" ]; then
+ echo "image_type=gravitino" >> $GITHUB_ENV
+ echo "image_name=datastrato/gravitino" >> $GITHUB_ENV
fi
- - uses: actions/checkout@v3
-
- name: Check publish Docker token
run: |
if [[ "${secrets_token}" != "${input_token}" ]]; then
@@ -59,6 +61,13 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-java@v3
+ with:
+ java-version: '8'
+ distribution: 'temurin'
+
- name: Build and Push the main branch Docker image
if: ${{ github.ref_name == 'main' }}
run: ./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${{ github.event.inputs.tag }} --latest
diff --git a/.gitignore b/.gitignore
index a12d193b32..c9266269b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,7 +36,7 @@ out/**
distribution
server/src/main/resources/project.properties
-dev/docker/hive/packages
+dev/docker/*/packages
docs/build
dev/docker/tools/docker-connector
diff --git a/dev/docker/README.md b/dev/docker/README.md
index ca06daa096..81660e924c 100644
--- a/dev/docker/README.md
+++ b/dev/docker/README.md
@@ -11,10 +11,23 @@ It can be utilized to test all catalog and connector modules within Gravitino.
## How to build Docker image
```
-./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [hive|trino] --image {image_name} --tag {tag_name} --latest
+./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|trino] --image {image_name} --tag {tag_name} --latest
```
# Version change history
+
+## Gravitino
+
+### Container startup commands
+```
+docker run --rm -d -p 8090:8090 datastrato/gravitino
+```
+
+### 0.3.0-SNAPSHOT
+- Gravitino Server
+- Expose ports:
+ - `8090` Gravitino Web UI
+
## Gravitino CI Hive
### Container startup commands
diff --git a/dev/docker/build-docker.sh b/dev/docker/build-docker.sh
index 543f53d241..edc0b15455 100755
--- a/dev/docker/build-docker.sh
+++ b/dev/docker/build-docker.sh
@@ -8,7 +8,7 @@ script_dir="$(dirname "${BASH_SOURCE-$0}")"
script_dir="$(cd "${script_dir}">/dev/null; pwd)"
# Build docker image for multi-arch
-USAGE="-e Usage: ./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [hive|trino] --image {image_name} --tag {tag_name} --latest"
+USAGE="-e Usage: ./build-docker.sh --platform [all|linux/amd64|linux/arm64] --type [gravitino|hive|trino] --image {image_name} --tag {tag_name} --latest"
# Get platform type
if [[ "$1" == "--platform" ]]; then
@@ -67,6 +67,8 @@ if [[ "${component_type}" == "hive" ]]; then
build_args="--build-arg HADOOP_PACKAGE_NAME=${HADOOP_PACKAGE_NAME} --build-arg HIVE_PACKAGE_NAME=${HIVE_PACKAGE_NAME}"
elif [ "${component_type}" == "trino" ]; then
true # Placeholder, do nothing
+elif [ "${component_type}" == "gravitino" ]; then
+ . ${script_dir}/gravitino/gravitino-dependency.sh
else
echo "ERROR : ${component_type} is not a valid component type"
echo ${USAGE}
diff --git a/dev/docker/gravitino/Dockerfile b/dev/docker/gravitino/Dockerfile
new file mode 100644
index 0000000000..a19d031e45
--- /dev/null
+++ b/dev/docker/gravitino/Dockerfile
@@ -0,0 +1,14 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
+FROM openjdk:8-jdk-buster
+LABEL maintainer="[email protected]"
+
+WORKDIR /root/gravitino
+
+COPY packages/gravitino /root/gravitino
+
+EXPOSE 8090
+
+ENTRYPOINT ["/bin/bash", "/root/gravitino/bin/gravitino.sh", "start"]
\ No newline at end of file
diff --git a/dev/docker/gravitino/gravitino-dependency.sh b/dev/docker/gravitino/gravitino-dependency.sh
new file mode 100755
index 0000000000..197b3b29fa
--- /dev/null
+++ b/dev/docker/gravitino/gravitino-dependency.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
+set -ex
+gravitino_dir="$(dirname "${BASH_SOURCE-$0}")"
+gravitino_dir="$(cd "${gravitino_dir}">/dev/null; pwd)"
+gravitino_home="$(cd "${gravitino_dir}/../../..">/dev/null; pwd)"
+
+# Prepare compile Gravitino packages
+${gravitino_home}/gradlew clean compileDistribution -x test
+
+# Removed old packages, Avoid multiple re-executions using the wrong file
+rm -rf "${gravitino_dir}/packages"
+mkdir -p "${gravitino_dir}/packages"
+
+cp -r "${gravitino_home}/distribution/package" "${gravitino_dir}/packages/gravitino"
+
+# Keeping the container running at all times
+cat <<EOF >> "${gravitino_dir}/packages/gravitino/bin/gravitino.sh"
+
+# Keeping a process running in the background
+tail -f /dev/null
+EOF
diff --git a/docs/integration-test.md b/docs/integration-test.md
index 6a90b2d2b1..0a798d191b 100644
--- a/docs/integration-test.md
+++ b/docs/integration-test.md
@@ -90,7 +90,7 @@ Before running the tests, make sure Docker is installed.
#### Running Gravitino Hive CI Docker Environment
-1. Run a hive docker test environment container locally using the `docker run --rm -d -p 8022:22 -p 8088:8088 -p 9000:9000 -p 9083:9083 -p 10000:10000 -p 10002:10002 -p 50010:50010 -p 50070:50070 -p 50075:50075 datastrato/gravitino-ci-hive` command.
+1. Run a hive docker test environment container locally using the `docker run --rm -d -p 8022:22 -p 8088:8088 -p 9000:9000 -p 9083:9083 -p 10000:10000 -p 10002:10002 -p 50010:50010 -p 50070:50070 -p 50075:50075 datastrato/gravitino-ci-hive:0.1.4` command.
The Gravitino server and Docker runtime environments will also use certain ports. Ensure that these ports are not already in use: