From d033a4556d43cc6bca7766d99959359968fbc953 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Tue, 24 Apr 2018 08:05:00 -0700 Subject: [PATCH] GitBook build scripts --- build/gitbook/Dockerfile | 19 +++++++++++++++++++ build/gitbook/cloudbuild.yaml | 27 +++++++++++++++++++++++++++ build/gitbook/config/deployment.yaml | 20 ++++++++++++++++++++ build/gitbook/config/service.yaml | 14 ++++++++++++++ docs/README.md | 8 ++++++++ docs/book/Dockerfile | 18 ++++++++++++++++++ 6 files changed, 106 insertions(+) create mode 100644 build/gitbook/Dockerfile create mode 100644 build/gitbook/cloudbuild.yaml create mode 100644 build/gitbook/config/deployment.yaml create mode 100644 build/gitbook/config/service.yaml create mode 100644 docs/README.md create mode 100644 docs/book/Dockerfile diff --git a/build/gitbook/Dockerfile b/build/gitbook/Dockerfile new file mode 100644 index 00000000000..0f55cc64d74 --- /dev/null +++ b/build/gitbook/Dockerfile @@ -0,0 +1,19 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed 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 node:6 + +RUN npm install -g gitbook-cli + +RUN gitbook fetch 3.2.3 diff --git a/build/gitbook/cloudbuild.yaml b/build/gitbook/cloudbuild.yaml new file mode 100644 index 00000000000..e431d19c7f0 --- /dev/null +++ b/build/gitbook/cloudbuild.yaml @@ -0,0 +1,27 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed 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. + +steps: +- name: "gcr.io/kubebuilder/gitbook" + dir: "docs/book" + args: ["/usr/local/bin/gitbook", "install"] +- name: "gcr.io/kubebuilder/gitbook" + dir: "docs/book" + args: ["/usr/local/bin/gitbook", "build"] +- name: "gcr.io/cloud-builders/docker" + dir: "docs/book" + args: ["build", ".", "-t", "gcr.io/kubebuilder/book"] +- name: "gcr.io/cloud-builders/docker" + dir: "docs/book" + args: ["push", "gcr.io/kubebuilder/book"] diff --git a/build/gitbook/config/deployment.yaml b/build/gitbook/config/deployment.yaml new file mode 100644 index 00000000000..8610e219cac --- /dev/null +++ b/build/gitbook/config/deployment.yaml @@ -0,0 +1,20 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + run: gitbook + name: gitbook +spec: + replicas: 3 + selector: + matchLabels: + run: gitbook + template: + metadata: + labels: + run: gitbook + spec: + containers: + - image: gcr.io/kubebuilder/book + imagePullPolicy: Always + name: gitbook \ No newline at end of file diff --git a/build/gitbook/config/service.yaml b/build/gitbook/config/service.yaml new file mode 100644 index 00000000000..9aab5753561 --- /dev/null +++ b/build/gitbook/config/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + run: gitbook + name: gitbook +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 80 + selector: + run: gitbook + type: LoadBalancer diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000000..649ac2c02d7 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,8 @@ + +# Running GitBook + +1. Follow the instructions at [https://toolchain.gitbook.com/](https://toolchain.gitbook.com/) to + install gitbook. +2. cd into the `docs/book` directory +3. Run `gitbook server` +4. Visit `localhost:4000` \ No newline at end of file diff --git a/docs/book/Dockerfile b/docs/book/Dockerfile new file mode 100644 index 00000000000..d1f341e18e4 --- /dev/null +++ b/docs/book/Dockerfile @@ -0,0 +1,18 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed 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 nginx + +COPY _book /usr/share/nginx/html \ No newline at end of file