apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    kubernetes.io/change-cause: "<to be filled in deploy_to_kubernetes script>"
  name: laa-legal-adviser-api-collect-static
spec:
  template:
    metadata:
      name: laa-legal-adviser-api-collect-static
      labels:
        app: laa-legal-adviser-api
        tier: collect-static
        type: job
        env: staging
    spec:
      restartPolicy: Never
      containers:
      - name: app
        image: "<to be set by deploy_to_kubernetes>"
        command: ["python", "manage.py", "collectstatic", "--noinput"]
        env:
        - name: ENV
          value: staging
        - name: SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: secret-key
              key: SECRET_KEY
        - name: SENTRY_DSN
          valueFrom:
            secretKeyRef:
              name: sentry
              key: dsn
        - name: STATIC_FILES_BACKEND
          value: s3
        - name: AWS_STORAGE_BUCKET_NAME
          valueFrom:
            secretKeyRef:
              name: s3
              key: bucket_name
        - name: AWS_ACCESS_KEY_ID
          valueFrom:
            secretKeyRef:
              name: s3
              key: access_key_id
        - name: AWS_SECRET_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: s3
              key: secret_access_key
        - name: AWS_S3_REGION_NAME
          valueFrom:
            secretKeyRef:
              name: s3
              key: region
