Last active
January 1, 2025 12:37
-
-
Save daniels-martins/48483f201d73fdb0ce2778624f883236 to your computer and use it in GitHub Desktop.
kubernetes manifest for laravel chat app
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: ConfigMap | |
| metadata: | |
| name: laravel-config | |
| namespace: default | |
| data: | |
| WWWGROUP: "${WWWGROUP}" | |
| WWWUSER: "${WWWUSER}" | |
| LARAVEL_SAIL: "1" | |
| XDEBUG_MODE: "${SAIL_XDEBUG_MODE}" | |
| XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG}" | |
| IGNITION_LOCAL_SITES_PATH: "${PWD}" | |
| DB_PASSWORD: "${DB_PASSWORD}" | |
| DB_DATABASE: "${DB_DATABASE}" | |
| DB_USERNAME: "${DB_USERNAME}" | |
| DB_HOST: "${DB_HOST}" | |
| --- | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: laravel-mysql-pod | |
| namespace: default | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: laravel-mysql | |
| template: | |
| metadata: | |
| labels: | |
| app: laravel-mysql | |
| spec: | |
| containers: | |
| - name: laravel | |
| image: martinsdaniels/lfc-chat:staging-v1.0.0 | |
| imagePullPolicy: Always | |
| ports: | |
| - containerPort: 80 | |
| name: http | |
| - containerPort: ${VITE_PORT} | |
| name: vite | |
| env: | |
| - name: WWWGROUP | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: WWWGROUP | |
| - name: WWWUSER | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: WWWUSER | |
| - name: LARAVEL_SAIL | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: LARAVEL_SAIL | |
| - name: XDEBUG_MODE | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: XDEBUG_MODE | |
| - name: XDEBUG_CONFIG | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: XDEBUG_CONFIG | |
| - name: DB_HOST | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: DB_HOST | |
| - name: IGNITION_LOCAL_SITES_PATH | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: IGNITION_LOCAL_SITES_PATH | |
| - name: mysql | |
| image: mysql/mysql-server:8.0 | |
| ports: | |
| - containerPort: 3306 | |
| env: | |
| - name: MYSQL_ROOT_PASSWORD | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: DB_PASSWORD | |
| - name: MYSQL_DATABASE | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: DB_DATABASE | |
| - name: MYSQL_USER | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: DB_USERNAME | |
| - name: MYSQL_PASSWORD | |
| valueFrom: | |
| configMapKeyRef: | |
| name: laravel-config | |
| key: DB_PASSWORD | |
| volumeMounts: | |
| - name: mysql-data | |
| mountPath: /var/lib/mysql | |
| - name: mysql-init | |
| mountPath: /docker-entrypoint-initdb.d/10-create-testing-database.sh | |
| subPath: 10-create-testing-database.sh | |
| livenessProbe: | |
| exec: | |
| command: | |
| - mysqladmin | |
| - ping | |
| - '-p${DB_PASSWORD}' | |
| initialDelaySeconds: 30 | |
| periodSeconds: 10 | |
| volumes: | |
| - name: laravel-volume | |
| hostPath: | |
| path: ./ | |
| - name: mysql-data | |
| persistentVolumeClaim: | |
| claimName: mysql-pvc | |
| - name: mysql-init | |
| hostPath: | |
| path: ./vendor/laravel/sail/database/mysql/create-testing-database.sh | |
| --- | |
| apiVersion: v1 | |
| kind: PersistentVolumeClaim | |
| metadata: | |
| name: mysql-pvc | |
| namespace: default | |
| spec: | |
| accessModes: | |
| - ReadWriteOnce | |
| resources: | |
| requests: | |
| storage: 1Gi | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: laravel-service | |
| namespace: default | |
| spec: | |
| selector: | |
| app: laravel-mysql | |
| ports: | |
| - name: http | |
| port: 80 | |
| targetPort: 80 | |
| - name: vite | |
| port: ${VITE_PORT} | |
| targetPort: ${VITE_PORT} | |
| - name: mysql | |
| port: 3306 | |
| targetPort: 3306 | |
| type: ClusterIP |
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
| services: | |
| laravel.test: | |
| build: | |
| context: './vendor/laravel/sail/runtimes/8.4' | |
| dockerfile: Dockerfile | |
| args: | |
| WWWGROUP: '${WWWGROUP}' | |
| image: 'sail-8.4/app' | |
| extra_hosts: | |
| - 'host.docker.internal:host-gateway' | |
| ports: | |
| - '${APP_PORT:-80}:80' | |
| - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' | |
| environment: | |
| WWWUSER: '${WWWUSER}' | |
| LARAVEL_SAIL: 1 | |
| XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' | |
| XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' | |
| IGNITION_LOCAL_SITES_PATH: '${PWD}' | |
| volumes: | |
| - '.:/var/www/html' | |
| networks: | |
| - sail | |
| depends_on: | |
| - mysql | |
| mysql: | |
| image: 'mysql/mysql-server:8.0' | |
| ports: | |
| - '${FORWARD_DB_PORT:-3306}:3306' | |
| environment: | |
| MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' | |
| MYSQL_ROOT_HOST: '%' | |
| MYSQL_DATABASE: '${DB_DATABASE}' | |
| MYSQL_USER: '${DB_USERNAME}' | |
| MYSQL_PASSWORD: '${DB_PASSWORD}' | |
| MYSQL_ALLOW_EMPTY_PASSWORD: 1 | |
| volumes: | |
| - 'sail-mysql:/var/lib/mysql' | |
| - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' | |
| networks: | |
| - sail | |
| healthcheck: | |
| test: | |
| - CMD | |
| - mysqladmin | |
| - ping | |
| - '-p${DB_PASSWORD}' | |
| retries: 3 | |
| timeout: 5s | |
| networks: | |
| sail: | |
| driver: bridge | |
| volumes: | |
| sail-mysql: | |
| driver: local |
tag the image built by sail with this command
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use this command
The dot is to provide context for docker to understand where the Dockerfile file is else use
-f path-to-the-dockerfileand maybe a context, I do not remember