apiVersion: batch/v1
kind: Job
metadata:
  name: artifacts
spec:
  template:
    spec:
      containers:
        - name: artifacts
          image: hyperledger/fabric-tools:2.3
          workingDir: /
          volumeMounts:
            - mountPath: /organizations
              name: fabricfiles
              subPath: organizations
            - mountPath: /configtx
              name: fabricfiles
              subPath: configtx
            - mountPath: /system-genesis-block
              name: fabricfiles
              subPath: system-genesis-block
            - mountPath: /channel-artifacts
              name: fabricfiles
              subPath: channel-artifacts
            - mountPath: /scripts
              name: fabricfiles
              subPath: scripts
          command:
            - /bin/bash
            - -c
            - |
              ./scripts/createGenesis.sh &&
              ./scripts/createChannel.sh
      restartPolicy: Never
      volumes:
        - name: fabricfiles
          persistentVolumeClaim:
            claimName: mypvc
