Last active
November 11, 2025 11:36
-
-
Save ludndev/bbb2e3ad1259a9dd630f6aa8aa937ddb to your computer and use it in GitHub Desktop.
🧩 Example: Pod with Prisma Migration Sidecar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: v1 | |
| kind: Pod | |
| metadata: | |
| name: my-app-with-prisma-migrate | |
| labels: | |
| app: my-app | |
| spec: | |
| restartPolicy: Always | |
| containers: | |
| # --- Main Application Container --- | |
| - name: my-app | |
| image: myregistry/my-app:latest | |
| ports: | |
| - containerPort: 3000 | |
| env: | |
| - name: DATABASE_URL | |
| valueFrom: | |
| secretKeyRef: | |
| name: my-database-secret | |
| key: DATABASE_URL | |
| # Optional: wait for migration sidecar to finish | |
| readinessProbe: | |
| httpGet: | |
| path: /health | |
| port: 3000 | |
| initialDelaySeconds: 10 | |
| periodSeconds: 5 | |
| # --- Sidecar for Prisma Migrations --- | |
| - name: prisma-migrate | |
| image: myregistry/my-app:latest | |
| command: ["sh", "-c"] | |
| args: | |
| - | | |
| echo "Running Prisma migrations..." && \ | |
| npm run prisma:migrate:prod | |
| env: | |
| - name: DATABASE_URL | |
| valueFrom: | |
| secretKeyRef: | |
| name: my-database-secret | |
| key: DATABASE_URL | |
| # this ensures migrations complete before the main app runs | |
| lifecycle: | |
| postStart: | |
| exec: | |
| command: ["sh", "-c", "echo 'Migration sidecar started'"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment