apiVersion: apps/v1
kind: Deployment
metadata:
  name: lty-admin
  labels:
    app: lty-admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lty-admin
  template:
    metadata:
      labels:
        app: lty-admin
    spec:
      containers:
      - name: lty-admin
        image: ${CI_REGISTRY_IMAGE}/lty-admin:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 3000
        env:
        - name: NODE_ENV
          value: "production"
        # NEXT_PUBLIC_API_BASE_URL 必须在 docker build 时通过 --build-arg 注入（Next.js 客户端打包），
        # 运行时在此处设置无效。详见 .gitea/workflows/deploy.yaml 与 qy-lty-admin/Dockerfile。
        livenessProbe:
          httpGet:
            path: /
            port: 3000
          initialDelaySeconds: 20
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
        resources:
          requests:
            memory: "128Mi"
            cpu: "100m"
          limits:
            memory: "512Mi"
            cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
  name: lty-admin
spec:
  selector:
    app: lty-admin
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
