apiVersion: apps/v1
kind: Deployment
metadata:
  name: php
  labels:
    tier: backend
spec:
  replicas: 5
  selector:
    matchLabels:
      app: php
      tier: backend
  template:
    metadata:
      labels:
        app: php
        tier: backend
    spec:
      volumes:
      - name: dir
        hostPath:
          path: /code
      containers:
      - name: php
        image: comercio/laravel
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: dir
          mountPath: /code
      initContainers:
      - name: install
        image: busybox
        volumeMounts:
        - name: dir
          mountPath: /code
        command:
        - cp
        - "-r"
        - "/var/www/."
        - "/code/app"