Concourse CI:static_buildpack问题

时间:2018-06-11 12:32:52

标签: concourse

我正在使用static_buildpack将简单的angular4应用程序部署到云代工厂。在访问应用程序时,我总是得到nginx 403问题。

jobs:
- name: app
  serial: true
  plan:
  - get: develop-repo
  - task: npm-build
    config:
        platform: linux
        image_resource:
            type: docker-image
            source:
                repository: node
        run:
            path: sh
            args:
            - -exec
            - |
                cd develop-repo
                npm install
                npm run dist                              
        inputs:
        - name: develop-repo
        outputs:
        - name:
  - put: develop
    params:
      manifest: develop-repo/manifest.yml
      current_app_name: app   
      path: develop-repo        



resources:
- name: develop-repo
  type: git
- name: develop
  type: cf

manifest.yml:

---
applications:
- name: app
  instances: 1
  memory: 512M
  disk_quota: 512M  
  buildpack: staticfile_buildpack 
  stack: cflinuxfs2 

我所做的只是git clone -> npm build -> cf deploy

注意:正确设置所有资源变量。为了更好的可读性而忽略了

1 个答案:

答案 0 :(得分:0)

在尝试了几个选项后,我发现通过将工件发布到输出文件夹,我们可以从输出文件夹中推送应用程序

---
jobs:
- name: app
  serial: true
  plan:
  - get: develop
  - task: npm-build
    config:
        platform: linux
        image_resource:
            type: docker-image
            source:
                repository: node
        inputs:
        - name: develop
        outputs:
        - name: artifacts
        run:
            path: sh
            args:
            - -exec
            - |
                cd develop
                npm install
                npm run dist
                ls
                cp -R dist ../artifacts/                            

  - put: deploy-cf
    params:
        manifest: develop/ci/manifests/manifest-int.yml
        path: artifacts/dist


resources:
- name: develop
  type: git
  source:
    uri: <<GITHUB-URI>>
    branch:<<GITHUB-BRANCH>>
    username:<<GITHUB-USERNAME>>
    password: <<GITHUB-PASSWORD>>
- name: deploy-cf
  type: cf
  source:
    api: <<CF-API>>
    username: <<CF-USERNAME>>
    password: <<CF-PASSWORD>>
    organization: <<CF-ORG>>
    space: <<CF-SPACE>>