1
0
Fork 0
This repository has been archived on 2025-08-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-backoffice-v1-monolith/charts/backoffice/templates/job-db-seed.yaml

46 lines
1.5 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-db-seed
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": before-hook-creation #,hook-succeeded
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: database-seed
spec:
backoffLimit: 0
ttlSecondsAfterFinished: 86400 # 1 day
activeDeadlineSeconds: 120 # 2 minutes
template:
spec:
{{- if .Values.dockerconfigjsonBase64 }}
imagePullSecrets:
- name: {{ .Release.Name }}-container-registry
{{- end }}
containers:
- name: {{ .Chart.Name }}-seed
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["/bin/sh", "-c"]
args:
- |
npm install esbuild --no-save
npx esbuild prisma/seed.ts --outfile=/app/cache/seed.cjs --bundle --format=cjs --external:prisma --external:@prisma/client --platform=node
node /app/cache/seed.cjs
envFrom:
- configMapRef:
name: {{ .Release.Name }}-config
- secretRef:
name: {{ .Release.Name }}-database
- secretRef:
name: {{ .Release.Name }}-nextauth
volumeMounts:
- mountPath: /app/cache
name: cache-volume
restartPolicy: Never
volumes:
- name: cache-volume
emptyDir:
sizeLimit: 2Mi