apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  selector:
    matchLabels:
      app: app
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
        - name: app
          image: img-app-deployment
          command:
            - "/bin/sh"
            - "-c"
            - "ln -s /var/www /usr/share/nginx; /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:
            - name: app-conf
              mountPath: /var/www/.env
              subPath: .env
      volumes:
        - name: app-conf
          configMap:
            name: app-conf
            items:
              - key: env
                path: .env
