apiVersion: apps/v1
kind: Deployment 
metadata:
    name: app
spec:
    replicas: 1
    selector:
      matchLabels:
        app: app

    template:
        metadata:
            labels:
                app: app
        spec:
            containers:
            - name: app
              # image: gcr.io/codeeducation-287605/app-laravel:edd9a39
              image: img-app-deployment
              command: ["/bin/sh", 
                        "-c", 
                        "chmod +x /var/wwww; ln -s /var/wwww /usr/share/nginx; chmod +x /var/www/k8s/entrypoint.sh; /var/www/k8s/entrypoint.sh; php-fpm;"]
              # command: ["/bin/sh", "-c", "/var/www/k8s/entrypoint.sh; php-fpm;"]
              ports:
              - containerPort: 80

              env:
              - name: DB_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: mysql-pass
                    key: password

              envFrom:
              - configMapRef:
                  name: app-conf

              volumeMounts:
              - mountPath: /var/www/.env
                name: app-conf
                subPath: .env

            volumes:
            - name: app-conf
              configMap:
                name: app-conf
                items:
                    - key: env
                      path: .env