apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspaceTemplate
metadata:
  name: che-code-dotnet
spec:
  commands:
    - id: init-container-command
      apply:
        component: che-code-injector
  events:
    preStart:
      - init-container-command
  components:
    - name: che-code-runtime-description
      container:
        image: registry.redhat.io/devspaces/udi-rhel8:3.5
        command:
          - /checode/entrypoint-volume.sh
        volumeMounts:
          - name: checode
            path: /checode
        memoryLimit: 1024Mi
        memoryRequest: 256Mi
        cpuLimit: 500m
        cpuRequest: 30m
        endpoints:
          - name: che-code
            attributes:
              type: main
              cookiesAuthEnabled: true
              discoverable: false
              urlRewriteSupported: true
            targetPort: 3100
            exposure: public
            secure: false
            protocol: https
          - name: code-redirect-1
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13131
            exposure: public
            protocol: http
          - name: code-redirect-2
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13132
            exposure: public
            protocol: http
          - name: code-redirect-3
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13133
            exposure: public
            protocol: http
      attributes:
        app.kubernetes.io/component: che-code-runtime
        app.kubernetes.io/part-of: che-code.eclipse.org
        controller.devfile.io/container-contribution: true
    - name: checode
      volume: {}
    - name: che-code-injector
      container:
        image: registry.redhat.io/devspaces/code-rhel8:3.5
        command:
          - /entrypoint-init-container.sh
        volumeMounts:
          - name: checode
            path: /checode
        memoryLimit: 256Mi
        memoryRequest: 32Mi
        cpuLimit: 500m
        cpuRequest: 30m
---
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
  name: dotnet
spec:
  started: true
  template:
    components:
      - name: tools
        container:
          image: registry.redhat.io/devspaces/udi-rhel8:3.5
          memoryLimit: 2Gi
          mountSources: true
          endpoints:
            - exposure: public
              name: hello-endpoint
              protocol: http
              targetPort: 5032
          volumeMounts:
            - name: nuget
              path: /home/user/.nuget
        attributes:
          controller.devfile.io/merge-contribution: true
      - name: nuget
        volume:
          size: 1G
    commands:
      - id: 1-update-dependencies
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/dotnet-web-simple
          commandLine: dotnet restore
          group:
            kind: build
      - id: 2-build
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/dotnet-web-simple
          commandLine: dotnet build
          group:
            kind: build
      - id: 3-run
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/dotnet-web-simple
          commandLine: dotnet run
          group:
            kind: run
    projects:
      - name: dotnet-web-simple
        zip:
          location: '{{ INTERNAL_URL }}/resources/v2/dotnet-web-simple.zip'
  contributions:
    - name: editor
      kubernetes:
        name: che-code-dotnet
