apiVersion: apps/v1
kind: Deployment
metadata:
  name: dhis-postgres
  labels:
    package: dhis
spec:
  replicas: 1
  selector:
    matchLabels:
      component: dhis-postgres
  template:
    metadata:
      labels:
        component: dhis-postgres
    spec:
      containers:
        - name: dhis-postgres
          image: mdillon/postgis:10-alpine
          ports:
            - containerPort: 5432
          env:
            - name: PGDATA
              value: /var/lib/postgresql/data/pgdata
            - name: POSTGRES_DB
              value: dhis2
            - name: POSTGRES_USER
              value: dhis
            - name: POSTGRES_PASSWORD
              value: dhis
          volumeMounts:
            - name: dhis-postgres-volume
              mountPath: /var/lib/postgresql/data
      restartPolicy: Always
      volumes:
        - name: dhis-postgres-volume
          persistentVolumeClaim:
            claimName: dhis-postgres-volume-claim
