From 87c94e36bfcecd73aefbdc5d2cfe396bd9926b9b Mon Sep 17 00:00:00 2001 From: Sem Schilder Date: Thu, 17 Aug 2023 11:39:46 +0200 Subject: [PATCH] Add copy from source --- charts/symfony-app/Chart.yaml | 4 ++-- charts/symfony-app/templates/deployment.yaml | 12 ++++++++++++ charts/symfony-app/values.yaml | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/symfony-app/Chart.yaml b/charts/symfony-app/Chart.yaml index 12dd5dd..b2091a0 100644 --- a/charts/symfony-app/Chart.yaml +++ b/charts/symfony-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: symfony-app description: A simple chart to deploy basic Symfony/PHP applications type: application -version: 0.4.0 +version: 0.4.1 appVersion: 'main' keywords: - php @@ -17,4 +17,4 @@ annotations: # Supported kind: added, changed, deprecated, removed, fixed and security artifacthub.io/changes: | - kind: added - description: "Added the option to spawn Symfony Messenger consumers" + description: "Added the option to copy over the source from the FPM image into the nginx container" diff --git a/charts/symfony-app/templates/deployment.yaml b/charts/symfony-app/templates/deployment.yaml index a8fa27d..3d673d4 100644 --- a/charts/symfony-app/templates/deployment.yaml +++ b/charts/symfony-app/templates/deployment.yaml @@ -53,6 +53,12 @@ spec: image: "{{ .Values.image.fpm.repository }}:{{ .Values.image.fpm.tag }}" imagePullPolicy: {{ .Values.image.fpm.pullPolicy }} workingDir: /app + {{- if .Values.source.copyFromFpm }} + lifecycle: + postStart: + exec: + command: [ "/bin/sh", "-c", "cp -r /app/. /app-shared" ] + {{- end }} {{- include "symfony-app.env" . | nindent 10 }} ports: - name: fpm @@ -61,9 +67,15 @@ spec: {{- toYaml .Values.probes.fpm | nindent 10 }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if not .Values.source.copyFromFpm }} volumeMounts: - name: app-directory mountPath: /app + {{- else }} + volumeMounts: + - name: app-directory + mountPath: /app-shared + {{- end }} {{- if .Values.pyroscope.enabled }} command: ['pyroscope'] args: ['exec', '-spy-name', 'phpspy', 'php-fpm'] diff --git a/charts/symfony-app/values.yaml b/charts/symfony-app/values.yaml index 4ba257c..4657958 100644 --- a/charts/symfony-app/values.yaml +++ b/charts/symfony-app/values.yaml @@ -25,6 +25,7 @@ image: ## # Only https sources are supported source: + copyFromFpm: true clone: true remote: https://github.com/symfony/demo.git version: 'v2.2.3'