-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinventree-app-deployment.yaml
84 lines (79 loc) · 2.59 KB
/
inventree-app-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
apiVersion: apps/v1
kind: Deployment
metadata:
name: inventree-app
labels:
app: inventree-app
spec:
replicas: 1
selector:
matchLabels:
app: inventree-app
strategy:
type: Recreate
template:
metadata:
labels:
app: inventree-app
spec:
initContainers:
- name: init-create-static-dir
image: busybox
command: ['sh', '-c', 'rm -rf /home/inventree/data/static']
volumeMounts:
- name: inventree-data
mountPath: /home/inventree/data
- name: init-migrate
image: inventree/inventree:0.17.1
workingDir: /home/inventree
command: ["/bin/sh", "-c", "python /home/inventree/src/backend/InvenTree/manage.py migrate"]
envFrom:
- configMapRef:
name: inventree-config
volumeMounts:
- name: inventree-data
mountPath: /home/inventree/data
containers:
- name: inventree-server
image: inventree/inventree:0.17.1
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: inventree-config
volumeMounts:
- name: inventree-data
mountPath: /home/inventree/data
- name: inventree-data
mountPath: /var/www/static
subPath: static
lifecycle:
postStart:
exec:
command: [
"/bin/sh", "-c",
"cp -rf /home/inventree/src/backend/InvenTree/InvenTree/static /home/inventree/data && \
cp -rf /home/inventree/src/backend/InvenTree/InvenTree/static_i18n/i18n /var/www/static/i18n && \
cp -rf /root/.local/lib/python3.11/site-packages/django/contrib/admin/static/admin /var/www/static/admin && \
mkdir -p /var/www/static/web/ && \
cp -rf /home/inventree/src/backend/InvenTree/web/static/web/* /var/www/static/web/"
]
- name: inventree-proxy
image: nginx:stable
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx.prod.conf
readOnly: true
- name: inventree-data
mountPath: /var/www
volumes:
- name: config
configMap:
name: inventree-nginx-config
- name: inventree-data
persistentVolumeClaim:
claimName: inventree-data
restartPolicy: Always