diff --git a/navix-helm/templates/frontend-deployment.yaml b/navix-helm/templates/frontend-deployment.yaml index 203a5f5..4c5725d 100644 --- a/navix-helm/templates/frontend-deployment.yaml +++ b/navix-helm/templates/frontend-deployment.yaml @@ -12,12 +12,33 @@ spec: labels: app: navix-frontend spec: + initContainers: + - name: copy-env + image: busybox + command: ["sh", "-c", "cp /config/env.js /env/env.js"] + volumeMounts: + - name: env-config + mountPath: /config + - name: env-volume + mountPath: /env + containers: - name: frontend image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}" imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} ports: - containerPort: 80 - env: - - name: VITE_API_URL - value: "http://navix-backend.{{ .Release.Namespace }}.svc.cluster.local:8000" + volumeMounts: + - name: env-volume + mountPath: /usr/share/nginx/html/env.js + subPath: env.js + + volumes: + - name: env-volume + emptyDir: {} + - name: env-config + configMap: + name: navix-frontend-env + items: + - key: env.js + path: env.js diff --git a/navix-helm/templates/frontend-env-configmap.yaml b/navix-helm/templates/frontend-env-configmap.yaml new file mode 100644 index 0000000..75e69c9 --- /dev/null +++ b/navix-helm/templates/frontend-env-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: navix-frontend-env +data: + env.js: | + window.env = { + VITE_API_URL: "http://navix-backend.{{ .Release.Namespace }}.svc.cluster.local:8000" + };