Helle there,
To contextualize, I am working on an web application using Google App Engine (GAE). In fact, I use three different GAE services. For the backend, analysis and the frontend with Angular.
In GIT my architecture is the following:
Indeed, I wrote a global cloudbuild.yaml
file on root as the following to call all of others specific cloudbuild.yaml
files in each services directories ("/api", "/analyse", "/frontend"):
steps:
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
for d in */; do
config="${d}cloudbuild.yaml"
if [[ ! -f "${config}" ]]; then
continue
fi
echo "Building $d ... "
(
gcloud builds submit $d --config=${config}
) &
done
wait
During the deployment, an error occurs in the "frontend" service steps let see his cloudbuild.yaml
file:
steps:
# Install Angular
- name: 'gcr.io/cloud-builders/npm'
args: ['install','-g','@angular/cli' ]
# Install node packages
- name: 'gcr.io/cloud-builders/npm'
args: [ 'install' ]
# Build productive files
- name: 'node:12'
entrypoint: npm
args: [ 'run', 'build', '--prod', '--aot' ]
# Deploy to google cloud app egnine
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'client.yaml']
The error occurs for the third step (in log step 2 because of starting at 0):
I am really confused with this error because I do not understand why the build method not working well. In fact, when I am running npm run build --prod
locally there is no problem.
I hope you could help me to solve this problem.
Thanks to spend time on my issue. I love you community ❤️
[EDIT]
A little update to add the package.json
dependencies.
{
"name": "frontend",
"version": "0.0.0",
"description": "The frontend part for the 4th year project",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.0.0",
"@angular/common": "~11.0.0",
"@angular/compiler": "~11.0.0",
"@angular/core": "~11.0.0",
"@angular/forms": "~11.0.0",
"@angular/platform-browser": "~11.0.0",
"@angular/platform-browser-dynamic": "~11.0.0",
"@angular/router": "~11.0.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.1",
"@angular/cli": "~11.0.1",
"@angular/compiler-cli": "~11.0.0",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
I suspect that the problem comes from the <base href="">
or from paths in the client.yaml
inside the frontend folder
The client.yaml
file:
service: default
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: dist/index.html
upload: frontend/index.html
- url: /
static_dir: dist
And the .gcloudignore
e2e/
node_modules/
src/
coverage
^(.*/)?\..*$
^(.*/)?.*\.json$
^(.*/)?.*\.md$
^(.*/)?.*\.yaml$
^LICENSE