apiVersion: batch/v1
kind: Job
metadata:
  name: rails-migration
spec:
  backoffLimit: 3
  parallelism: 1
  completions: 1
  template:
    spec:
      containers:
      - name: rails-migration
        image: 938859087688.dkr.ecr.ap-northeast-1.amazonaws.com/esm-lounge-test:latest
        ports:
          - containerPort: 3000
        env:
          - name: RAILS_ENV
            value: production
          - name: RAILS_LOG_TO_STDOUT
            value: "true"
          - name: DATABASE_URL
            valueFrom:
              secretKeyRef:
                name: rails
                key: database_url
          - name: SECRET_KEY_BASE
            valueFrom:
              secretKeyRef:
                name: rails
                key: secret_key_base
        args:
          - "bundle"
          - "exec"
          - "rails"
          - "db:migrate"
      restartPolicy: Never
