Added deployment capabilities
This commit is contained in:
parent
777b0fccc8
commit
577d61ed42
3
docs/.gitignore
vendored
3
docs/.gitignore
vendored
@ -18,3 +18,6 @@
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
|
.k8s/remote*.yml
|
||||||
|
!.k8s/remote.example.yml
|
61
docs/.k8s/local.yml
Normal file
61
docs/.k8s/local.yml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# =========================================
|
||||||
|
# App manifest
|
||||||
|
# =========================================
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-deployment
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: m4g-docs
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: m4g-docs
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: m4g-docs
|
||||||
|
image: m4g_docs:latest
|
||||||
|
imagePullPolicy: Never
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Service
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-service
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: m4g-docs
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
|
type: NodePort
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Ingress
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-ingress
|
||||||
|
spec:
|
||||||
|
ingressClassName: caddy
|
||||||
|
rules:
|
||||||
|
- host: m4g.docs.local
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: m4g-docs-service
|
||||||
|
port:
|
||||||
|
number: 80
|
67
docs/.k8s/remote.example.yml
Normal file
67
docs/.k8s/remote.example.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# =========================================
|
||||||
|
# App manifest
|
||||||
|
# =========================================
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-deployment
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: m4g-docs
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: m4g-docs
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: m4g-docs
|
||||||
|
image: git.devdisciples.com/devdisciples/m4gdocs:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Service
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-service
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: m4g-docs
|
||||||
|
ports:
|
||||||
|
- protocol: TCP
|
||||||
|
port: 80
|
||||||
|
targetPort: 80
|
||||||
|
type: NodePort
|
||||||
|
|
||||||
|
---
|
||||||
|
# App Ingress
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: m4g-docs-ingress
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: lets-encrypt
|
||||||
|
spec:
|
||||||
|
ingressClassName: public
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- m4g.example.com
|
||||||
|
secretName: example-tls-secret
|
||||||
|
rules:
|
||||||
|
- host: m4g.example.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: m4g-docs-service
|
||||||
|
port:
|
||||||
|
number: 80
|
27
docs/Dockerfile
Normal file
27
docs/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
# Stage 1: Base image.
|
||||||
|
## Start with a base image containing NodeJS so we can build Docusaurus.
|
||||||
|
FROM node:lts AS base
|
||||||
|
## Disable colour output from yarn to make logs easier to read.
|
||||||
|
ENV FORCE_COLOR=0
|
||||||
|
## Enable corepack.
|
||||||
|
RUN corepack enable
|
||||||
|
## Set the working directory to `/opt/docusaurus`.
|
||||||
|
WORKDIR /opt/docusaurus
|
||||||
|
|
||||||
|
# Stage 2b: Production build mode.
|
||||||
|
FROM base AS prod
|
||||||
|
## Set the working directory to `/opt/docusaurus`.
|
||||||
|
WORKDIR /opt/docusaurus
|
||||||
|
## Copy over the source code.
|
||||||
|
COPY . /opt/docusaurus/
|
||||||
|
## Install dependencies with `--immutable` to ensure reproducibility.
|
||||||
|
RUN npm ci
|
||||||
|
## Build the static site.
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
## Use a stable nginx image
|
||||||
|
FROM nginx:stable-alpine AS deploy
|
||||||
|
WORKDIR /home/node/app
|
||||||
|
COPY --chown=node:node --from=prod /opt/docusaurus/build/ /usr/share/nginx/html/
|
@ -39,3 +39,9 @@ $ GIT_USER=<Your GitHub username> yarn deploy
|
|||||||
```
|
```
|
||||||
|
|
||||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
||||||
|
|
||||||
|
|
||||||
|
### Custom
|
||||||
|
|
||||||
|
kubectl --kubeconfig ~/.kube/main.k8s.config apply -f .k8s/remote.yml
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
"start": "docusaurus start",
|
"start": "docusaurus start --host 0.0.0.0",
|
||||||
"build": "docusaurus build",
|
"build": "docusaurus build",
|
||||||
"swizzle": "docusaurus swizzle",
|
"swizzle": "docusaurus swizzle",
|
||||||
"deploy": "docusaurus deploy",
|
"deploy": "docusaurus deploy",
|
||||||
|
Loading…
Reference in New Issue
Block a user