├── .gitignore
├── Dockerfile
├── README.md
├── deploy-to-kubernetes.yaml
├── environment
├── config-dev.yaml
├── config-prod.yaml
├── dev.properties
└── prod.properties
├── helm-chart
├── .helmignore
├── Chart.yaml
├── config-values
│ ├── config-dev.yaml
│ └── config-prod.yaml
├── templates
│ ├── NOTES.txt
│ ├── _helpers.tpl
│ ├── configMap.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ └── tests
│ │ └── test-connection.yaml
└── values.yaml
├── kubernetes
├── deployment.yaml
└── service.yaml
├── kustomize
├── base
│ ├── deployment.yaml
│ ├── kustomization.yaml
│ └── service.yaml
└── overlays
│ ├── dev
│ ├── dev.properties
│ └── kustomization.yaml
│ ├── local
│ ├── kustomization.yaml
│ └── local.properties
│ └── prod
│ ├── deployment-prod.yaml
│ ├── kustomization.yaml
│ └── prod.properties
├── package-lock.json
├── package.json
├── public
├── config.js
├── favicon.ico
├── index.html
├── logo.png
├── manifest.json
└── robots.txt
├── skaffold.yaml
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── serviceWorker.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 | /.idea/
25 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # build environment
2 | FROM node:12.2.0-alpine as build
3 | WORKDIR /app
4 |
5 | ENV PATH /app/node_modules/.bin:$PATH
6 | COPY package.json /app/package.json
7 | RUN npm install --silent
8 | RUN npm config set unsafe-perm true #https://stackoverflow.com/questions/52196518/could-not-get-uid-gid-when-building-node-docker
9 | RUN npm install react-scripts@3.0.1 -g --silent
10 | COPY . /app
11 | RUN npm run build
12 |
13 | # production environment
14 | FROM nginx:1.16.0-alpine
15 | COPY --from=build /app/build /usr/share/nginx/html
16 | EXPOSE 80
17 | CMD ["nginx", "-g", "daemon off;"]
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2 |
3 | ## Available Scripts
4 |
5 | In the project directory, you can run:
6 |
7 | ### `npm start`
8 |
9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11 |
12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console.
14 |
15 | ### `npm test`
16 |
17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19 |
20 | ### `npm run build`
21 |
22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance.
24 |
25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed!
27 |
28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29 |
30 |
31 | # Deploy on Kubernetes
32 |
33 | ## Normal objects
34 |
35 | ### Build docker image
36 | ```
37 | docker build --tag multi-stage-react-app-example:latest .
38 | ```
39 |
40 | #### Deploy with native `kubectl` commands
41 | ```
42 | kubectl apply -f kubernetes/config-dev.yaml # creates the configMap in the Kubernetes cluster
43 | kubectl apply -f kubernetes/deployment.yaml
44 | kubectl apply -f kubernetes/service.yaml
45 | ```
46 |
47 | ** Undo deployments **
48 |
49 | ```
50 | kubectl delete configMap multi-stage-react-app-example-config
51 | kubectl delete deployment multi-stage-react-app-example
52 | kubectl delete service multi-stage-react-app-example
53 | ```
54 |
55 | Forward port
56 |
57 | ```
58 | kubectl port-forward svc/multi-stage-react-app-example 3001:80
59 | ```
60 |
61 | Then access the app at [http://localhost:3001](http://localhost:3001)
62 |
63 | ## Deploy with [helm](https://helm.sh/)
64 |
65 | ### Create release
66 | ```
67 | helm upgrade dev-release ./helm-chart/ --install --force --values helm-chart/config-values/config-dev.yaml
68 | helm ls #verify dev-release is present
69 | ```
70 |
71 |
72 | ### Undo release
73 |
74 | ```
75 | helm delete --purge dev-release
76 | ```
77 |
78 | ## Deploy with [kustomize](https://kustomize.io/)
79 |
80 | Build with kustomize to see what Kubernetes objects are generated
81 | ```
82 | kustomize build kustomize/base/
83 | ```
84 |
85 | Apply base
86 | ```
87 | kubectl apply -k kustomize/base
88 | ```
89 |
90 | Undo
91 | ```
92 | kubectl delete -k kustomize/base
93 | ```
94 |
95 | Apply DEV overlay
96 | ```
97 | kubectl apply -k kustomize/overlays/dev
98 | ```
99 |
100 | Undo
101 | ```
102 | kubectl delete -k kustomize/overlays/dev
103 | ```
104 |
105 | ## Cherry on the cake - use [skaffold](https://skaffold.dev/)
106 |
107 | > We will use [skaffold profiles](https://skaffold.dev/docs/how-tos/profiles/)
108 |
109 | ### Deploy via kubectl
110 | ```
111 | skaffold run -p native-kubernetes
112 | ```
113 |
114 | ```
115 | skaffold delete -p native-kubernetes
116 | ```
117 |
118 |
119 | ### Deploy via kustomize
120 |
121 | For example build the prod thing:
122 | ```
123 | skaffold run -p kustomize-prod
124 | ```
125 |
126 | ```
127 | skaffold delete -p kustomize-prod
128 | ```
129 |
--------------------------------------------------------------------------------
/deploy-to-kubernetes.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app.kubernetes.io/component: service
6 | name: multi-stage-react-app-example
7 | spec:
8 | ports:
9 | - name: http
10 | port: 80
11 | protocol: TCP
12 | targetPort: 80
13 | selector:
14 | app: multi-stage-react-app-example
15 | type: NodePort
16 | ---
17 | apiVersion: apps/v1
18 | kind: Deployment
19 | metadata:
20 | labels:
21 | app.kubernetes.io/component: service
22 | name: multi-stage-react-app-example
23 | spec:
24 | replicas: 1
25 | selector:
26 | matchLabels:
27 | app: multi-stage-react-app-example
28 | template:
29 | metadata:
30 | labels:
31 | app.kubernetes.io/component: service
32 | app: multi-stage-react-app-example
33 | spec:
34 | containers:
35 | - name: multi-stage-react-app-example
36 | image: multi-stage-react-app-example:latest
37 | imagePullPolicy: IfNotPresent
38 | ports:
39 | - containerPort: 80
--------------------------------------------------------------------------------
/environment/config-dev.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: multi-stage-react-app-example-config
5 | data:
6 | config.js: |
7 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
8 | window.REACT_APP_ENVIRONMENT='DEV'
9 | window.REACT_APP_NAVBAR_COLOR='LightGreen'
10 |
--------------------------------------------------------------------------------
/environment/config-prod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: multi-stage-react-app-example-config
5 | data:
6 | config.js: |
7 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
8 | window.REACT_APP_ENVIRONMENT='PROD'
9 | window.REACT_APP_NAVBAR_COLOR='LightPink'
10 |
--------------------------------------------------------------------------------
/environment/dev.properties:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='DEV'
3 | window.REACT_APP_NAVBAR_COLOR='LightGreen'
4 |
--------------------------------------------------------------------------------
/environment/prod.properties:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='PROD'
3 | window.REACT_APP_NAVBAR_COLOR='LightPink'
4 |
--------------------------------------------------------------------------------
/helm-chart/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *~
18 | # Various IDEs
19 | .project
20 | .idea/
21 | *.tmproj
22 | .vscode/
23 |
--------------------------------------------------------------------------------
/helm-chart/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | appVersion: "1.0"
3 | description: A Helm chart for Kubernetes
4 | name: helm-chart
5 | version: 0.1.0
6 |
--------------------------------------------------------------------------------
/helm-chart/config-values/config-dev.yaml:
--------------------------------------------------------------------------------
1 | configValues: |
2 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
3 | window.REACT_APP_ENVIRONMENT='DEV'
4 | window.REACT_APP_NAVBAR_COLOR='LightGreen'
5 |
6 |
--------------------------------------------------------------------------------
/helm-chart/config-values/config-prod.yaml:
--------------------------------------------------------------------------------
1 | configValues: |
2 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
3 | window.REACT_APP_ENVIRONMENT='PROD'
4 | window.REACT_APP_NAVBAR_COLOR='LightPink'
5 |
6 |
--------------------------------------------------------------------------------
/helm-chart/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | 1. Get the application URL by running these commands:
2 | {{- if .Values.ingress.enabled }}
3 | {{- range $host := .Values.ingress.hosts }}
4 | {{- range $.Values.ingress.paths }}
5 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }}
6 | {{- end }}
7 | {{- end }}
8 | {{- else if contains "NodePort" .Values.service.type }}
9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helm-chart.fullname" . }})
10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11 | echo http://$NODE_IP:$NODE_PORT
12 | {{- else if contains "LoadBalancer" .Values.service.type }}
13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14 | You can watch the status of by running 'kubectl get svc -w {{ include "helm-chart.fullname" . }}'
15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helm-chart.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
16 | echo http://$SERVICE_IP:{{ .Values.service.port }}
17 | {{- else if contains "ClusterIP" .Values.service.type }}
18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19 | echo "Visit http://127.0.0.1:8080 to use your application"
20 | kubectl port-forward $POD_NAME 8080:80
21 | {{- end }}
22 |
--------------------------------------------------------------------------------
/helm-chart/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/* vim: set filetype=mustache: */}}
2 | {{/*
3 | Expand the name of the chart.
4 | */}}
5 | {{- define "helm-chart.name" -}}
6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7 | {{- end -}}
8 |
9 | {{/*
10 | Create a default fully qualified app name.
11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12 | If release name contains chart name it will be used as a full name.
13 | */}}
14 | {{- define "helm-chart.fullname" -}}
15 | {{- if .Values.fullnameOverride -}}
16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17 | {{- else -}}
18 | {{- $name := default .Chart.Name .Values.nameOverride -}}
19 | {{- if contains $name .Release.Name -}}
20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21 | {{- else -}}
22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23 | {{- end -}}
24 | {{- end -}}
25 | {{- end -}}
26 |
27 | {{/*
28 | Create chart name and version as used by the chart label.
29 | */}}
30 | {{- define "helm-chart.chart" -}}
31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32 | {{- end -}}
33 |
--------------------------------------------------------------------------------
/helm-chart/templates/configMap.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: {{ .Release.Name }}-multi-stage-react-app-example-config
5 | annotations:
6 | # https://github.com/helm/helm/blob/master/docs/charts_hooks.md
7 | "helm.sh/hook-delete-policy": "before-hook-creation"
8 | "helm.sh/hook": pre-install, pre-upgrade
9 | data:
10 | config.js: {{ toYaml .Values.configValues | indent 4 }}
11 |
--------------------------------------------------------------------------------
/helm-chart/templates/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: {{ include "helm-chart.fullname" . }}
5 | labels:
6 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
7 | helm.sh/chart: {{ include "helm-chart.chart" . }}
8 | app.kubernetes.io/instance: {{ .Release.Name }}
9 | app.kubernetes.io/managed-by: {{ .Release.Service }}
10 | spec:
11 | replicas: {{ .Values.replicaCount }}
12 | selector:
13 | matchLabels:
14 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
15 | app.kubernetes.io/instance: {{ .Release.Name }}
16 | template:
17 | metadata:
18 | labels:
19 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
20 | app.kubernetes.io/instance: {{ .Release.Name }}
21 | spec:
22 | imagePullSecrets:
23 | - name: {{ .Values.image.imagePullSecrets }}
24 | containers:
25 | - name: {{ .Chart.Name }}
26 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
27 | imagePullPolicy: {{ .Values.image.pullPolicy }}
28 | ports:
29 | - name: http
30 | containerPort: 80
31 | protocol: TCP
32 | livenessProbe:
33 | httpGet:
34 | path: /
35 | port: http
36 | readinessProbe:
37 | httpGet:
38 | path: /
39 | port: http
40 | volumeMounts:
41 | - name: multi-stage-react-app-example-config-volume
42 | mountPath: /usr/share/nginx/html/config.js
43 | subPath: config.js
44 | readOnly: true
45 | resources:
46 | {{- toYaml .Values.resources | nindent 12 }}
47 | volumes:
48 | - name: multi-stage-react-app-example-config-volume
49 | configMap:
50 | name: {{ .Release.Name }}-multi-stage-react-app-example-config
51 | {{- with .Values.nodeSelector }}
52 | nodeSelector:
53 | {{- toYaml . | nindent 8 }}
54 | {{- end }}
55 | {{- with .Values.affinity }}
56 | affinity:
57 | {{- toYaml . | nindent 8 }}
58 | {{- end }}
59 | {{- with .Values.tolerations }}
60 | tolerations:
61 | {{- toYaml . | nindent 8 }}
62 | {{- end }}
63 |
--------------------------------------------------------------------------------
/helm-chart/templates/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ include "helm-chart.fullname" . }}
5 | labels:
6 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
7 | helm.sh/chart: {{ include "helm-chart.chart" . }}
8 | app.kubernetes.io/instance: {{ .Release.Name }}
9 | app.kubernetes.io/managed-by: {{ .Release.Service }}
10 | spec:
11 | type: {{ .Values.service.type }}
12 | ports:
13 | - port: {{ .Values.service.port }}
14 | targetPort: http
15 | protocol: TCP
16 | name: http
17 | selector:
18 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
19 | app.kubernetes.io/instance: {{ .Release.Name }}
20 |
--------------------------------------------------------------------------------
/helm-chart/templates/tests/test-connection.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Pod
3 | metadata:
4 | name: "{{ include "helm-chart.fullname" . }}-test-connection"
5 | labels:
6 | app.kubernetes.io/name: {{ include "helm-chart.name" . }}
7 | helm.sh/chart: {{ include "helm-chart.chart" . }}
8 | app.kubernetes.io/instance: {{ .Release.Name }}
9 | app.kubernetes.io/managed-by: {{ .Release.Service }}
10 | annotations:
11 | "helm.sh/hook": test-success
12 | spec:
13 | containers:
14 | - name: wget
15 | image: busybox
16 | command: ['wget']
17 | args: ['{{ include "helm-chart.fullname" . }}:{{ .Values.service.port }}']
18 | restartPolicy: Never
19 |
--------------------------------------------------------------------------------
/helm-chart/values.yaml:
--------------------------------------------------------------------------------
1 | # Default values for helm-chart.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 |
5 | replicaCount: 1
6 |
7 | image:
8 | repository: multi-stage-react-app-example
9 | tag: latest
10 | pullPolicy: IfNotPresent
11 | imagePullSecrets: cfcr
12 |
13 | nameOverride: ""
14 | fullnameOverride: ""
15 |
16 | service:
17 | type: NodePort
18 | port: 80
19 |
20 | ingress:
21 | enabled: false
22 | annotations: {}
23 | # kubernetes.io/ingress.class: nginx
24 | # kubernetes.io/tls-acme: "true"
25 | paths: []
26 | hosts:
27 | - chart-example.local
28 | tls: []
29 | # - secretName: chart-example-tls
30 | # hosts:
31 | # - chart-example.local
32 |
33 | resources: {}
34 |
35 | nodeSelector: {}
36 |
37 | tolerations: []
38 |
39 | affinity: {}
40 |
41 | configValues: |
42 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
43 | window.REACT_APP_ENVIRONMENT='LOCAL with helm'
44 | window.REACT_APP_NAVBAR_COLOR='LightBlue'
45 |
--------------------------------------------------------------------------------
/kubernetes/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app.kubernetes.io/component: service
6 | name: multi-stage-react-app-example
7 | spec:
8 | replicas: 1
9 | selector:
10 | matchLabels:
11 | app: multi-stage-react-app-example
12 | template:
13 | metadata:
14 | labels:
15 | app.kubernetes.io/component: service
16 | app: multi-stage-react-app-example
17 | spec:
18 | containers:
19 | - name: multi-stage-react-app-example
20 | image: multi-stage-react-app-example:latest
21 | imagePullPolicy: IfNotPresent
22 | ports:
23 | - containerPort: 80
24 | volumeMounts:
25 | - name: multi-stage-react-app-example-config-volume
26 | mountPath: /usr/share/nginx/html/config.js
27 | subPath: config.js
28 | readOnly: true
29 | volumes:
30 | - name: multi-stage-react-app-example-config-volume
31 | configMap:
32 | name: multi-stage-react-app-example-config
33 |
--------------------------------------------------------------------------------
/kubernetes/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app.kubernetes.io/component: service
6 | name: multi-stage-react-app-example
7 | spec:
8 | ports:
9 | - name: http
10 | port: 80
11 | protocol: TCP
12 | targetPort: 80
13 | selector:
14 | app: multi-stage-react-app-example
15 | type: NodePort
16 |
--------------------------------------------------------------------------------
/kustomize/base/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | labels:
5 | app.kubernetes.io/component: service
6 | name: multi-stage-react-app-example
7 | spec:
8 | replicas: 1
9 | selector:
10 | matchLabels:
11 | app: multi-stage-react-app-example
12 | template:
13 | metadata:
14 | labels:
15 | app.kubernetes.io/component: service
16 | app: multi-stage-react-app-example
17 | spec:
18 | containers:
19 | - name: multi-stage-react-app-example
20 | image: multi-stage-react-app-example:latest
21 | imagePullPolicy: IfNotPresent
22 | ports:
23 | - containerPort: 80
24 | volumeMounts:
25 | - name: multi-stage-react-app-example-config-volume
26 | mountPath: /usr/share/nginx/html/config.js
27 | subPath: config.js
28 | readOnly: true
29 | volumes:
30 | - name: multi-stage-react-app-example-config-volume
31 | configMap:
32 | name: multi-stage-react-app-example-config
33 |
--------------------------------------------------------------------------------
/kustomize/base/kustomization.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: kustomize.config.k8s.io/v1beta1
2 | kind: Kustomization
3 | resources:
4 | - deployment.yaml
5 | - service.yaml
6 |
7 | commonLabels:
8 | app.kubernetes.io/name: multi-stage-react-app-example
9 |
--------------------------------------------------------------------------------
/kustomize/base/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | app.kubernetes.io/component: service
6 | name: multi-stage-react-app-example
7 | spec:
8 | ports:
9 | - name: http
10 | port: 80
11 | protocol: TCP
12 | targetPort: 80
13 | selector:
14 | app: multi-stage-react-app-example
15 | type: NodePort
16 |
--------------------------------------------------------------------------------
/kustomize/overlays/dev/dev.properties:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='DEV'
3 | window.REACT_APP_NAVBAR_COLOR='LightGreen'
4 |
--------------------------------------------------------------------------------
/kustomize/overlays/dev/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | configMapGenerator:
5 | - name: multi-stage-react-app-example-config
6 | files:
7 | - config.js=dev.properties #add here the key config.js as you would when creating with kubectl
8 |
--------------------------------------------------------------------------------
/kustomize/overlays/local/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | configMapGenerator:
5 | - name: multi-stage-react-app-example-config
6 | files:
7 | - config.js=local.properties #add here the key config.js as you would when creating with kubectl
8 |
--------------------------------------------------------------------------------
/kustomize/overlays/local/local.properties:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='LOCAL'
3 | window.REACT_APP_NAVBAR_COLOR='LightBlue'
--------------------------------------------------------------------------------
/kustomize/overlays/prod/deployment-prod.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: multi-stage-react-app-example
5 | spec:
6 | replicas: 2
7 |
8 |
--------------------------------------------------------------------------------
/kustomize/overlays/prod/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | patchesStrategicMerge:
5 | - deployment-prod.yaml
6 |
7 | configMapGenerator:
8 | - name: multi-stage-react-app-example-config
9 | files:
10 | - config.js=prod.properties #add here the key config.js as you would when creating with kubectl
11 |
--------------------------------------------------------------------------------
/kustomize/overlays/prod/prod.properties:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='PROD'
3 | window.REACT_APP_NAVBAR_COLOR='LightPink'
4 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "multi-stage-react-app-example",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "axios": "^0.21.1",
7 | "react": "^16.9.0",
8 | "react-dom": "^16.9.0",
9 | "react-scripts": "3.1.1"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test",
15 | "eject": "react-scripts eject"
16 | },
17 | "eslintConfig": {
18 | "extends": "react-app"
19 | },
20 | "browserslist": {
21 | "production": [
22 | ">0.2%",
23 | "not dead",
24 | "not op_mini all"
25 | ],
26 | "development": [
27 | "last 1 chrome version",
28 | "last 1 firefox version",
29 | "last 1 safari version"
30 | ]
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/public/config.js:
--------------------------------------------------------------------------------
1 | window.REACT_APP_API_URL='https://www.bookmarks.dev/api/public/bookmarks'
2 | window.REACT_APP_ENVIRONMENT='LOCAL - public dir'
3 | window.REACT_APP_NAVBAR_COLOR='LightBlue'
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodepediaOrg/multi-stage-react-app-example/5d0099131bcf3c7394b8484ec80aeab46441d71b/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |