diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 1c735888..6727c0db 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -154,6 +154,10 @@ sudo sysctl -w kern.maxfiles=100000 sudo sysctl -w kern.maxfilesperproc=65535 ``` +## Docker + +[Docker Setup Guide](./docker/README.md) + # How it is deployed While the above describes how the content is built locally, https://knative.dev/ is built and served by [Netlify](https://netlify.com/) on their platform. diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..7838589b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:18.04 + +RUN apt-get update -y && apt-get install git wget -y + +RUN wget https://github.com/gohugoio/hugo/releases/download/v0.81.0/hugo_extended_0.81.0_Linux-64bit.deb +RUN dpkg -i hugo_extended_0.81.0_Linux-64bit.deb + +RUN git clone --recurse-submodules https://github.com/knative/website.git +RUN git clone https://github.com/knative/docs.git + +WORKDIR /website + +COPY scripts.patch . +RUN patch -p0 < scripts.patch + +ENTRYPOINT ["/bin/bash", "scripts/localbuild.sh","-s","reload"] + +EXPOSE 1313 diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..c49bcb77 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,39 @@ +# knative-docs-docker + +```bash +git clone git@github.com:knative/website.git +``` + +```bash +cd website/docker +``` + +```bash +docker build -t {USER/knative-docs} . +``` + +There are custom scripts that avoid deletion of this folder in processsourcefiles. If using the default version of the script (not in the Dockerfile image build) then it will delete the directory. **Test this out using a test directory you have cloned and change GOPATH to the test directory. (/home/user/testing/docs/docs)** + +Just Docs +```bash +docker run --name=knative-docs -d -v $GOPATH/src/github.com/knative.dev/docs/docs:/website/content/en/docs -p 9001:1313 USER/knative-docs:latest +``` + +Docs and Blog +```bash +docker run --name=knative-docs -d -v $GOPATH/src/github.com/knative.dev/docs/docs:/website/content/en/docs -v $GOPATH/src/github.com/knative.dev/docs/blog:/website/content/en/blog -p 9001:1313 USER/knative-docs:latest +``` + +This will run the service on port 9001, but you can pick any port you want. The container is listening on 1313. + +If you want to run an already built image you can specify mpetason/knative-docs:latest instead of building locally. + +Just Docs +```bash +docker run --name=knative-docs -d -v $GOPATH/src/github.com/knative.dev/docs/docs:/website/content/en/docs -p 9001:1313 mpetason/knative-docs:latest +``` + +Docs and Blog +```bash +docker run --name=knative-docs -d -v $GOPATH/src/github.com/knative.dev/docs/docs:/website/content/en/docs -v $GOPATH/src/github.com/knative.dev/docs/blog:/website/content/en/blog -p 9001:1313 mpetason/knative-docs:latest +``` \ No newline at end of file diff --git a/docker/scripts.patch b/docker/scripts.patch new file mode 100644 index 00000000..f161cfdc --- /dev/null +++ b/docker/scripts.patch @@ -0,0 +1,67 @@ +--- scripts/localbuild.sh 2021-03-22 14:07:32.533556409 -0700 ++++ docker/localbuild.sh 2021-04-12 20:56:04.615203305 -0700 +@@ -150,11 +150,11 @@ + ;; + s) + echo 'Running Hugo server' +- SERVER="server $LIVERELOAD" +- if [ "${OPTARG}" = "reload" ]; then +- echo 'with live reload' +- LIVERELOAD=" --disableFastRender --renderToDisk" +- fi ++ SERVER="server " ++ # if [ "${OPTARG}" = "reload" ]; then ++ # echo 'with live reload' ++ # LIVERELOAD=" --disableFastRender --renderToDisk" ++ # fi + ;; + esac + done +@@ -167,7 +167,7 @@ + + # BUILD MARKDOWN + # Start HUGO build +-hugo $SERVER --baseURL "" --environment "$BUILDENVIRONMENT" --gc ++exec hugo $SERVER --disableFastRender --baseURL "" --environment "$BUILDENVIRONMENT" --bind=0.0.0.0 --gc + + if [ -z "$SERVER" ]; then + echo '' +@@ -175,3 +175,4 @@ + echo '' + echo 'Static HTML files output to public/. Open public/index.html to view these files.' + fi ++ +--- scripts/processsourcefiles.sh 2021-04-07 11:05:32.746104145 -0700 ++++ docker/processsourcefiles.sh 2021-04-12 20:56:07.385965069 -0700 +@@ -8,7 +8,7 @@ + # A temp directory is used and move files around and prevent git clone errors (fails if directory exists). + + # Clean slate: Make sure that nothing from a past build exists in the /content/ or /temp/ folders +-rm -rf content/en ++# rm -rf content/en + rm -rf temp + + if [ "$BUILDALLRELEASES" = "true" ] +@@ -27,7 +27,7 @@ + git clone --quiet -b main https://github.com/"$FORK".git content/en + echo 'Getting pre-release development docs from main branch' + # Move "pre-release" docs content into the 'development' folder: +- mv content/en/docs content/en/development ++ # mv content/en/docs content/en/development + # DOCS BRANCHES + echo '------ Cloning all docs releases ------' + # Get versions of released docs from their branches in "$FORK" +@@ -67,7 +67,7 @@ + echo '------ BUILDING YOUR LOCAL KNATIVE/DOCS CLONE ------' + echo 'Copying local clone of knative/docs into the /docs folder under:' + pwd +- cp -r ../docs content/en/ ++ #cp -r ../docs content/en/ + if [ -d "../community" ]; then + echo 'Also copying the local clone of knative/community into the /community/contributing folder.' + cp -r ../community/* content/en/community/contributing +@@ -184,3 +184,4 @@ + # GET HANDCRAFTED SITE LANDING PAGE + echo 'Copying the override files into the /content/ folder' + cp -rfv content-override/* content/ ++