Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Vue.js app on Google App Engine?

I created a simple Vue.js application. Then I created a build for production using npm run build command which creates dist folder in the project structure.

Then I use gcloud app deploy command to deploy it to Google App Engine, but then the deployment stops and gives error as:

ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files. New versions are limited to 10000 files for this app.

Can someone please tell me what is the proper way to deploy Vue.js application to Google App Engine?

like image 432
Sayali Saitawdekar Avatar asked Mar 20 '19 12:03

Sayali Saitawdekar


People also ask

Where do I deploy Vue app?

There are a lot of services you can use to deploy your Vue JS application some of these places include: Git platforms such as GitHub Pages, GitLab Pages, and Bitbucket Pages, other platforms include Firebase hosting, Heroku, Digital Ocean, AWS solutions, CloudFront, Now and Surge and many more.

How do I deploy Vue app to host?

Let's host the Vue app on shared hosting! All we need to do is to execute npm run build command in the project folder. The command will then generate a dist directory that will consist of the files of our application. Then we will have to upload the whole folder to the hosting.


2 Answers

Have you tried deploying your Vue.js app to Google App Engine using Cloud Build? I have had no problem deploying any Vue.js apps in this way. Try following this tutorial for complete instructions.

Basically, you would have to include the following two files in your project root directory when deploying your Vue.js app to Google App Engine via Cloud Build:

  1. App.yaml

    runtime: nodejs10
    handlers:
      # Serve all static files with urls ending with a file extension
    - url: /(.*\..+)$ 
      static_files: dist/\1
      upload: dist/(.*\..+)$
      # catch all handler to index.html
    - url: /.*
      static_files: dist/index.html
      upload: dist/index.html
    

and

  1. cloudbuild.yaml

    steps:
    - name: node:10.15.1
      entrypoint: npm
      args: ["install"]
    - name: node:10.15.1
      entrypoint: npm
      args: ["run", "build"]
    - name: "gcr.io/cloud-builders/gcloud"
      args: ["app", "deploy"]
    timeout: "1600s"
    

In the case you're not using cloud build you may just use the app.yaml above and reference the steps implied in the cloudbuild.yaml, which means:

  1. run npm install
  2. run npm run build
  3. run gcloud app deploy
like image 180
highfivebrian Avatar answered Oct 22 '22 16:10

highfivebrian


You have too many files in the project. In your app.yaml file, add the skip_files tag to it so the deployment does not include unnecessary files or folder in the upload. You can also mix with regex so for example:

skip_files:
- node_modules/
- .gitignore
- src/
- public/
- babel.config.js
- ^(.*/)?\..*$
like image 39
Kobby Fletcher Avatar answered Oct 22 '22 16:10

Kobby Fletcher