apiVersion: apps/v1
kind: Deployment
metadata:
  name: queue-worker
  labels:
    app: queue-worker
spec:
  strategy:
    type: Recreate
  replicas: 1
  selector:
    matchLabels:
      app: queue-worker
  template:
    metadata:
      labels:
        app: queue-worker
    spec:
      volumes:
        - name: cache
          emptyDir: {}
        - name: testing
          emptyDir: {}
        - name: views
          emptyDir: {}
        - name: app-storage
          emptyDir: {}
      imagePullSecrets:
          - name: docker-credentials
      securityContext:
        fsGroup: 1000
      containers:
        - name: queue
          image: ghcr.io/rendyananta/urlhub:${APP_VERSION}
          imagePullPolicy: Always
          resources:
            limits:
              cpu: 100m
              memory: 100Mi
          volumeMounts:
          - name: cache
            mountPath: /var/www/html/storage/framework/cache
          - name: views
            mountPath: /var/www/html/storage/framework/views
          - name: testing
            mountPath: /var/www/html/storage/framework/testing
          - name: app-storage
            mountPath: /var/www/html/storage/app
          envFrom:
            - configMapRef:
                name: app
            - secretRef:
                name: app
          command:
            - "php"
          args:
            - "artisan"
            - "queue:work"
