apiVersion: batch/v1beta1
kind: CronJob

metadata:
  namespace: singouins-dev
  name: sep-backend-angular-cronjob
  labels:
    tier: sep-backend
spec:
  concurrencyPolicy: Forbid
  schedule: "00 02 * * *" # At 02:00 every day
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never

          containers:
          - name: sep-backend-angular
            image: singouins/ng-cli:12
            imagePullPolicy: Always
            resources:
              limits:
                memory: 2048Mi
                cpu: 1000m
              requests:
                memory: 128Mi
                cpu: 50m
            env:
              - name: BUILD_TYPE
                value: 'proto'
              - name: GIT_REPO
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-git-repo
              - name: GIT_USER
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-git-user
              - name: GIT_TOKEN
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-git-token
              - name: QUIET
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-build-quiet
              - name: OUTPUT_PATH
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-output-path
              - name: OUTPUT_FOLDER
                valueFrom:
                  secretKeyRef:
                    name: sep-backend-angular-secret
                    key: angular-output-folder
            volumeMounts:
             - name: websites
               mountPath: /websites

          volumes:
          - name: websites
            persistentVolumeClaim:
              claimName: sep-backend-code-websites
