1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add a Dockerfile + yarn script for local build and serve of mkdocs with auto update enabled

This commit is contained in:
Mario Sarcher 2020-10-29 16:14:49 +01:00
parent 058a32f5fb
commit 1bc96ef597
4 changed files with 53 additions and 1 deletions

View File

@ -45,6 +45,16 @@ Allows for faster separate re-runs of some of the more involved processes:
1. `yarn dev:extension-types` compile declaration types for `@k8slens/extensions`
1. `yarn dev-run` runs app in dev-mode and auto-restart when main process file has changed
## Development (documentation)
Run a local instance of `mkdocs serve` in a docker container for developing the Lens Documentation.
> Prerequisites: docker, yarn
* `yarn mkdocs-serve-local` - local build and serve of mkdocs with auto update enabled
Go to [localhost:8000](http://127.0.0.1:8000)
## Developer's ~~RTFM~~ recommended list:
- [TypeScript](https://www.typescriptlang.org/docs/home.html) (front-end/back-end)
@ -53,6 +63,8 @@ Allows for faster separate re-runs of some of the more involved processes:
- [ElectronJS](https://www.electronjs.org/docs) (chrome/node)
- [NodeJS](https://nodejs.org/dist/latest-v12.x/docs/api/) (api docs)
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/lensapp/lens.

35
mkdocs/Dockerfile Normal file
View File

@ -0,0 +1,35 @@
ARG PYTHON_VERSION=3.8.1-alpine3.11
FROM python:${PYTHON_VERSION} as builder
ENV PYTHONUNBUFFERED 1
# Set build directory
WORKDIR /wheels
# Copy files necessary
COPY ./requirements.txt .
# Perform build and cleanup artifacts
RUN \
apk add --no-cache \
git \
git-fast-import \
&& apk add --no-cache --virtual .build gcc musl-dev \
&& python -m pip install --upgrade pip \
&& pip install -r requirements.txt \
&& apk del .build gcc musl-dev \
&& rm -rf /usr/local/lib/python3.8/site-packages/mkdocs/themes/*/* \
&& rm -rf /tmp/*
# Set final MkDocs working directory
WORKDIR /docs
# Expose MkDocs development server port
EXPOSE 8000
# Start development server by default
ENTRYPOINT ["mkdocs"]
CMD ["serve", "--dev-addr=0.0.0.0:8000"]

4
mkdocs/requirements.txt Normal file
View File

@ -0,0 +1,4 @@
# Direct dependencies
mkdocs==1.1.2
mkdocs-material==6.1.0
mkdocs-git-revision-date-localized-plugin==0.7.3

View File

@ -37,7 +37,8 @@
"download:kubectl": "yarn run ts-node build/download_kubectl.ts",
"download:helm": "yarn run ts-node build/download_helm.ts",
"build:tray-icons": "yarn run ts-node build/build_tray_icon.ts",
"lint": "eslint $@ --ext js,ts,tsx --max-warnings=0 src/"
"lint": "eslint $@ --ext js,ts,tsx --max-warnings=0 src/",
"mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest"
},
"config": {
"bundledKubectlVersion": "1.17.11",