kind: pipeline
type: docker
name: deploy

steps:
  - name: build
    image: node:18-alpine
    volumes:
      - name: website-data
        path: /host-target
    commands:
      - npm ci || npm install
      - npm run build
      - cp -a . /host-target
      - chmod -R 777 /host-target

  - name: sync-files
    image: alpine:latest
    volumes:
      - name: website-data
        path: /host-target
    commands:
      - ls -la /host-target
      - ls -la /host-target/assets/images/
      - ls -la /host-target/assets/icons/
      - echo "Deployment completed successfully"

volumes:
  - name: website-data
    host:
      path: /root/kh3website/data/html
