Docker site (#3393)
* commit
* commit
* commit
* clean up python script.
* commit
* successfully generating static docs in docker container
* clean up
* clean up
* clean up
diff --git a/website2/website/package-lock.json b/website2/website/package-lock.json
index 72fe317..d71c815 100644
--- a/website2/website/package-lock.json
+++ b/website2/website/package-lock.json
@@ -8382,7 +8382,7 @@
}
},
"react-dev-utils": {
- "version": "5.0.2",
+ "version": "5.0.3",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-5.0.2.tgz",
"integrity": "sha512-d2FbKvYe4XAQx5gjHBoWG+ADqC3fGZzjb7i9vxd/Y5xfLkBGtQyX7aOb8lBRQPYUhjngiD3d49LevjY1stUR0Q==",
"dev": true,
@@ -10661,6 +10661,11 @@
}
}
},
+ "yarn": {
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/yarn/-/yarn-1.19.1.tgz",
+ "integrity": "sha512-gBnfbL9rYY05Gt0cjJhs/siqQXHYlZalTjK3nXn2QO20xbkIFPob+LlH44ML47GcR4VU9/2dYck1BWFM0Javxw=="
+ },
"yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
diff --git a/website2/website/package.json b/website2/website/package.json
index ad11a11..cea786f 100644
--- a/website2/website/package.json
+++ b/website2/website/package.json
@@ -14,5 +14,7 @@
"replace-in-file": "^3.4.0",
"redoc": "^2.0.0-alpha.30"
},
- "dependencies": {}
+ "dependencies": {
+ "yarn": "^1.19.1"
+ }
}
diff --git a/website2/website/scripts/Dockerfile.ubuntu18.04 b/website2/website/scripts/Dockerfile.ubuntu18.04
new file mode 100644
index 0000000..218d4c0
--- /dev/null
+++ b/website2/website/scripts/Dockerfile.ubuntu18.04
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+FROM ubuntu:18.04
+
+# This is passed to the heron build command via the --config flag
+ENV TARGET_PLATFORM ubuntu
+ENV bazelVersion 0.26.0
+
+RUN apt-get update && apt-get -y install \
+ g++ \
+ cmake \
+ automake \
+ libtool-bin \
+ libunwind8 \
+ patch \
+ python-dev \
+ wget \
+ zip \
+ virtualenv \
+ unzip \
+ git \
+ curl \
+ openjdk-8-jdk-headless \
+ tree \
+ python-setuptools \
+ python-dev \
+ python-wheel \
+ python \
+ python-pip \
+ curl \
+ sudo
+
+RUN curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
+
+RUN apt-get update && apt-get install -y nodejs
+
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+
+RUN wget -O /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$bazelVersion/bazel-$bazelVersion-installer-linux-x86_64.sh \
+ && chmod +x /tmp/bazel.sh \
+ && /tmp/bazel.sh
+
+ADD bazelrc /root/.bazelrc
+
diff --git a/website2/website/scripts/build-site.sh b/website2/website/scripts/build-site.sh
index 69c6b08..fea4b2a 100755
--- a/website2/website/scripts/build-site.sh
+++ b/website2/website/scripts/build-site.sh
@@ -23,9 +23,8 @@
set -x -e
cd ${ROOT_DIR}/website2/website
-
-yarn
-yarn build
+#npm install yarn
+npm build
node ./scripts/replace.js
@@ -33,7 +32,9 @@
mkdir -p ${ROOT_DIR}/generated-site/content
## copy generated site
cp -R build/incubator-heron/* ${ROOT_DIR}/generated-site/content
-## copy java docs
-cp -R ${ROOT_DIR}/website2/website/public/api/java/* ${ROOT_DIR}/generated-site/content/api/java/
+## copy java docs website2/website/static/api
+cp -R ${ROOT_DIR}/website2/website/static/api/* ${ROOT_DIR}/generated-site/content/api/java/
## copy pydocs
-cp -R ${ROOT_DIR}/website2/website/static/api/python/* ${ROOT_DIR}/generated-site/content/api/python/
\ No newline at end of file
+cp -R ${ROOT_DIR}/website2/website/static/api/python/* ${ROOT_DIR}/generated-site/content/api/python/
+## remove bazelrc for dockerfile
+rm ${ROOT_DIR}/website2/website/scripts/bazelrc
\ No newline at end of file
diff --git a/website2/website/scripts/compile-docker.sh b/website2/website/scripts/compile-docker.sh
new file mode 100755
index 0000000..e96ef73
--- /dev/null
+++ b/website2/website/scripts/compile-docker.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+set -o nounset
+set -o errexit
+
+realpath() {
+ echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
+}
+
+DOCKER_DIR=$(dirname $(dirname $(realpath $0)))
+echo "docker dir: $DOCKER_DIR"
+PROJECT_DIR=$(dirname $DOCKER_DIR)
+echo "project dir: $PROJECT_DIR"
+
+verify_dockerfile_exists() {
+ if [ ! -f $1 ]; then
+ echo "The Dockerfile $1 does not exist"
+ exit 1
+ fi
+}
+
+dockerfile_path_for_platform() {
+ echo "$PROJECT_DIR/website/scripts/Dockerfile.$1"
+}
+
+copy_bazel_rc_to() {
+ cp $PROJECT_DIR/../tools/docker/bazel.rc $1
+}
+
+
+
+TARGET_PLATFORM="ubuntu18.04"
+DOCKER_FILE=$(dockerfile_path_for_platform $TARGET_PLATFORM)
+verify_dockerfile_exists $DOCKER_FILE
+copy_bazel_rc_to $PROJECT_DIR/website/scripts/bazelrc
+
+echo "docker file"
+echo $DOCKER_FILE
+
+echo "Building heron-compiler container"
+docker build -t heron-compiler:$TARGET_PLATFORM -f $DOCKER_FILE .
+
+
+docker run \
+ --rm \
+ -v $PROJECT_DIR/..:/dist \
+ -t heron-compiler:$TARGET_PLATFORM make -C /dist/website2/website/ buildsite
+
diff --git a/website2/website/scripts/python-doc-gen.sh b/website2/website/scripts/python-doc-gen.sh
index 5ad1f35..2c63ee7 100755
--- a/website2/website/scripts/python-doc-gen.sh
+++ b/website2/website/scripts/python-doc-gen.sh
@@ -16,30 +16,21 @@
# specific language governing permissions and limitations
# under the License.
-# Install Dependencies
-#sudo apt-get update && sudo apt install -y automake cmake libtool-bin g++ \
-# python-setuptools python-dev python-wheel python python-pip unzip tree openjdk-8-jdk virtualenv
-
-# Install Bazel 0.26
-#wget -O ./bazel-0.26.0-installer-linux-x86_64.sh https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-installer-linux-x86_64.sh && \
-# chmod +x ./bazel-0.26.0-installer-linux-x86_64.sh && \
-#./bazel-0.26.0-installer-linux-x86_64.sh --user && \
-# export PATH="$PATH:$HOME/bin"
-
set -e
HERONPY_VERSION=$1
HERON_ROOT_DIR=$(git rev-parse --show-toplevel)
cd ${HERON_ROOT_DIR}
-# ./bazel_configure.py
+./bazel_configure.py
# Generate python whl packages, packages will be generated in ${HERON_ROOT_DIR}/bazel-genfiles/scripts/packages/
-bazel build --config=ubuntu scripts/packages:pypkgs
+bazel build --config=ubuntu scripts/packages:pypkgs
cd website2/website/
mkdir -p ./tmp/
TMP_DIR=./tmp
+rm -rf ./venv/
mkdir -p ./venv/
VENV=./venv/
echo $VENV
@@ -47,7 +38,6 @@
virtualenv "$VENV"
source "$VENV/bin/activate"
-
pip install pdoc==0.3.2
pip install --ignore-installed six
# Install the heronpy