Skip to content

Commit

Permalink
Docker site (apache#3393)
Browse files Browse the repository at this point in the history
* commit

* commit

* commit

* clean up python script.

* commit

* successfully generating static docs in docker container

* clean up

* clean up

* clean up
  • Loading branch information
joshfischer1108 authored and sreev committed Apr 9, 2020
1 parent 9d7c1ac commit a23b42a
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 21 deletions.
7 changes: 6 additions & 1 deletion website2/website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion website2/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"replace-in-file": "^3.4.0",
"redoc": "^2.0.0-alpha.30"
},
"dependencies": {}
"dependencies": {
"yarn": "^1.19.1"
}
}
59 changes: 59 additions & 0 deletions website2/website/scripts/Dockerfile.ubuntu18.04
Original file line number Diff line number Diff line change
@@ -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

13 changes: 7 additions & 6 deletions website2/website/scripts/build-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ VERSION=0.20
set -x -e

cd ${ROOT_DIR}/website2/website

yarn
yarn build
#npm install yarn
npm build

node ./scripts/replace.js

rm -rf ${ROOT_DIR}/generated-site/content
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/
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
63 changes: 63 additions & 0 deletions website2/website/scripts/compile-docker.sh
Original file line number Diff line number Diff line change
@@ -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

16 changes: 3 additions & 13 deletions website2/website/scripts/python-doc-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,28 @@
# 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
PIP_LOCATION=${HERON_ROOT_DIR}/bazel-genfiles/scripts/packages

virtualenv "$VENV"
source "$VENV/bin/activate"

pip install pdoc==0.3.2
pip install --ignore-installed six
# Install the heronpy
Expand Down

0 comments on commit a23b42a

Please sign in to comment.