簡體   English   中英

如何使用 CI-CD 流程將 Angular8 應用程序部署到谷歌應用引擎?

[英]How to deploy an Angular8 application to google app engine using CI-CD process?

我正在嘗試使用CI-CD流程將我的 UI 應用程序部署到google app engine 這對我來說是全新的。 以下是我遵循的步驟:

  1. 鏡像了我的 bitbucket 存儲庫。
  2. 創建cloudbuild.yamlapp.yaml文件。
  3. 創建了一個雲構建觸發器。

這是我的 cloudbuild.yaml 文件:

steps:
# Install npm
- name: 'node:10.10.0'
  args: ['npm', 'install']
  dir: './UI'
# Build productive file
- name: 'node:10.10.0'
  args: ['npm', 'run', 'build', '--prod']
  dir: './UI'
# Deploy UI to CP-D
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy', './']
  dir: './UI'

app.yaml:

runtime: python27
threadsafe: true

handlers:
- url:  /(.*\.js)
  mime_type: text/javascript
  static_files: EPortal/\1
  upload: EPortal/(.*\.js)

- url:  /favicon.ico
  static_files: EPortal/favicon.ico
  upload: EPortal/assets/favicon.ico

- url:  /(.*\.(gif|png|jpg|css|js|json)(|\.map))$
  static_files: EPortal/\1
  upload: EPortal/(.*)(|\.map)

- url:  /(.*\.svg)
  static_files: EPortal/\1
  upload: EPortal/(.*\.svg)
  mime_type: image/svg+xml

- url:  /.*
  secure: always
  redirect_http_response_code: 301
  static_files: EPortal/index.html
  upload: EPortal/index\.html
  http_headers:
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Frame-Options: DENY

以下是生成的日志。 由於安全原因,僅粘貼少量日志:

Step #2: Do you want to continue (Y/n)?  
Step #2: Beginning deployment of service [default]...
Step #2: ERROR: (gcloud.app.deploy) Cannot upload file [/workspace/UI/node_modules/canvas/build/Release/librsvg-2.so.2], which has size [47123185] (greater than maximum allowed size of [33554432]). Please delete the file or add to the skip_files entry in your application .yaml file and try again.
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1

除了我的deployment ,一切都運行良好。 由於size問題未部署。 如果你能幫我解決這個問題,那將是一個很大的幫助。

謝謝你。

Python 應用程序中是否需要node_modules 看起來這只是為了構建一個 static 站點。 在這種情況下,您可能希望忽略node_modules

鑒於您當前的應用程序配置,它可能如下所示:

runtime: python27
threadsafe: true
skip_files:
  - node_modules/

handlers:
- url:  /(.*\.js)
  mime_type: text/javascript
  static_files: EPortal/\1
  upload: EPortal/(.*\.js)

- url:  /favicon.ico
  static_files: EPortal/favicon.ico
  upload: EPortal/assets/favicon.ico

- url:  /(.*\.(gif|png|jpg|css|js|json)(|\.map))$
  static_files: EPortal/\1
  upload: EPortal/(.*)(|\.map)

- url:  /(.*\.svg)
  static_files: EPortal/\1
  upload: EPortal/(.*\.svg)
  mime_type: image/svg+xml

- url:  /.*
  secure: always
  redirect_http_response_code: 301
  static_files: EPortal/index.html
  upload: EPortal/index\.html
  http_headers:
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    X-Frame-Options: DENY

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM