diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..6cb161f36 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +externals/*/target +*/target +target +.git +.idea +.github diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index e2da68423..a97bc5804 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -145,6 +145,16 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + # https://github.com/docker/build-push-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build Kyuubi Docker Image + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile + load: true + tags: apache/kyuubi:latest # from https://github.com/marketplace/actions/setup-minikube-kubernetes-cluster - name: Setup Minikube uses: manusa/actions-setup-minikube@v2.4.2 @@ -161,7 +171,7 @@ jobs: - name: kyuubi pod check run: kubectl get pods - name: integration tests - run: ./build/mvn clean test -Pkubernetes -Dtest=none -DwildcardSuites=org.apache.kyuubi.kubernetes.test + run: ./build/mvn clean test -pl :kyuubi-common_2.12,:kubernetes-integration-tests_2.12 -Pkubernetes -Dtest=none -DwildcardSuites=org.apache.kyuubi.kubernetes.test - name: Upload test logs if: failure() uses: actions/upload-artifact@v2 diff --git a/docker/Dockerfile b/docker/Dockerfile index 266352ac7..d376a673c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,18 +16,30 @@ # # Usage: -# 1. use ./build/dist to make binary distributions of Kyuubi or download a release -# 2. Untar it and run the docker command below -# docker build -f docker/Dockerfile -t yaooqinn/kyuubi:tagname . +# Run the docker command below +# docker build --build-arg MVN_ARG="-Pspark-3.1,spark-hadoop-3.2" -f docker/Dockerfile -t apache/kyuubi:tagname . # Options: # -f this docker file # -t the target repo and tag name # more options can be found with -h -# TODO: REPALCE it with offical spark image iff Apache Spark community deploy -# Or make one after kyuubi to be setup under ASF -ARG SPARK_IMAGE=yaooqinn/spark:3.0.3 -FROM ${SPARK_IMAGE} +# declare the BASE_IMAGE argument in the first line. for more detail see: https://github.com/moby/moby/issues/38379 +ARG BASE_IMAGE=openjdk:8-jdk + +FROM maven:3.6-jdk-8 as builder + +ARG MVN_ARG + +ADD . /workspace/kyuubi +WORKDIR /workspace/kyuubi + +RUN ./build/dist ${MVN_ARG} && \ + mv /workspace/kyuubi/dist /opt/kyuubi && \ + # Removing stuff saves time because docker creates a temporary layer + rm -rf ~/.m2 && \ + rm -rf /workspace/kyuubi + +FROM ${BASE_IMAGE} ARG kyuubi_uid=10009 @@ -38,9 +50,11 @@ ENV KYUUBI_LOG_DIR ${KYUUBI_HOME}/logs ENV KYUUBI_PID_DIR ${KYUUBI_HOME}/pid ENV KYUUBI_WORK_DIR_ROOT ${KYUUBI_HOME}/work +COPY --from=builder /opt/kyuubi ${KYUUBI_HOME} + RUN set -ex && \ - sed -i 's/http:\/\/deb.\(.*\)/https:\/\/deb.\1/g' /etc/apt/sources.list && \ apt-get update && \ + DEBIAN_FRONTEND=noninteractive \ apt install -y bash tini libc6 libpam-modules krb5-user libnss3 procps && \ useradd -u ${kyuubi_uid} -g root kyuubi && \ mkdir -p ${KYUUBI_HOME} ${KYUUBI_LOG_DIR} ${KYUUBI_PID_DIR} ${KYUUBI_WORK_DIR_ROOT} && \ @@ -48,11 +62,6 @@ RUN set -ex && \ chmod a+rwx -R ${KYUUBI_WORK_DIR_ROOT} && \ rm -rf /var/cache/apt/* -COPY bin ${KYUUBI_HOME}/bin -COPY conf ${KYUUBI_HOME}/conf -COPY jars ${KYUUBI_HOME}/jars -COPY externals/engines/spark ${KYUUBI_HOME}/externals/engines/spark - WORKDIR ${KYUUBI_HOME} CMD [ "./bin/kyuubi", "run" ] diff --git a/kubernetes/integration-tests/test-k8s.yaml b/kubernetes/integration-tests/test-k8s.yaml index 1ec204b46..5962f8071 100644 --- a/kubernetes/integration-tests/test-k8s.yaml +++ b/kubernetes/integration-tests/test-k8s.yaml @@ -25,8 +25,7 @@ spec: serviceAccountName: kyuubi containers: - name: kyuubi-server - # TODO: replace this with the official repo - image: yaooqinn/kyuubi:latest + image: apache/kyuubi:latest imagePullPolicy: IfNotPresent env: - name: KYUUBI_JAVA_OPTS