apiVersion: batch/v1
kind: Job
metadata:
  namespace: railsgoat
  name: setup
spec:
  template:
    metadata:
      name: setup
    spec:
      containers:
      - name: setup
        # If your node is arm64 architecture, use hnts/railsgoat.
        image: owasp/railsgoat:latest
        # If your node is arm64 architecture, use Never policy.
        imagePullPolicy: Always
        command: ["/bin/sh"]
        args: ["-c", "bundle exec rails db:setup && bundle exec rails db:migrate"]
        envFrom:
        - configMapRef:
            name: rails-config
      restartPolicy: Never
