diff --git a/.kontinuous/env/dev/values.yaml b/.kontinuous/env/dev/values.yaml index 3eb859f2..e3624c54 100644 --- a/.kontinuous/env/dev/values.yaml +++ b/.kontinuous/env/dev/values.yaml @@ -1,17 +1,25 @@ api: + cmd: true args: - sh - -c - - "yarn strapi import -f ../seed-data.tar.gz && yarn start" - preDeploy: - cleaner: - match: - kind: Deployment - value: true + - "yarn strapi import --force -f seed-data.tar.gz && yarn start" + ~preDeploy.cleaner: + match: + kind: Deployment + value: true -pg: - preDeploy: - cleaner: - match: - kind: clusters.postgresql.cnpg.io - value: true + # Strapi wants to move the entire uploads dir to a backup when you import data + # so public cannot be a volume, it must be its parent + # see https://github.com/strapi/strapi/issues/17809 + initContainers: + - name: move-public-to-volume + image: + "{{ .Values.global.registry }}/{{ .Values.global.projectName }}/{{ + .Values.global.imageRepository }}/api:{{ .Values.global.imageTag }}" + command: ["/bin/sh", "-c"] + args: + - cp -r public/* /mnt/public; + volumeMounts: + - name: public + mountPath: /mnt/public diff --git a/.kontinuous/values.yaml b/.kontinuous/values.yaml index d5db94c6..00039c0c 100644 --- a/.kontinuous/values.yaml +++ b/.kontinuous/values.yaml @@ -31,17 +31,21 @@ api: HOST: "0.0.0.0" PORT: "1337" DATABASE_CLIENT: postgres + replicas: 1 # mandatory because volume is RWO + strategyType: Recreate # idem + securityContext: + fsGroup: 1000 volumes: - - name: uploads - emptyDir: {} + - name: public volumeMounts: - - mountPath: /app/public/uploads - name: uploads + - mountPath: /app/public + name: public jobs: runs: build-next-app: use: build + ~needs: ["api"] with: context: ./next-app imagePackage: next-app diff --git a/next-app/Dockerfile b/next-app/Dockerfile index 083a62f7..34227bdf 100644 --- a/next-app/Dockerfile +++ b/next-app/Dockerfile @@ -13,6 +13,9 @@ ENV NEXT_PUBLIC_MATOMO_SITE_ID="34" ENV NEXT_PUBLIC_MATOMO_URL="https://matomo.fabrique.social.gouv.fr/" ENV NODE_ENV=production +ARG NEXT_PUBLIC_STRAPI_API_URL +ENV NEXT_PUBLIC_STRAPI_API_URL $NEXT_PUBLIC_STRAPI_API_URL + RUN yarn build FROM node:20 as runner diff --git a/next-app/package.json b/next-app/package.json index 7e4732ce..da8e044d 100644 --- a/next-app/package.json +++ b/next-app/package.json @@ -29,7 +29,7 @@ "scripts": { "dev": "next dev", "start": "next start", - "build": "next build --experimental-build-mode compile", + "build": "next build", "lint": "eslint .", "k8s": "yarn --silent --cwd .k8s", "predev": "only-include-used-icons",