I recently watched this video on how to publish an Angular app with firebase-tools project with the help of Google Cloud Build.
So the build trigger is working, but it always fails to complete the last step, which is to deploy the project to firebase.
The log from the last step:
ERROR: build step 4 "gcr.io/(PROJECT_ID)/firebase" failed: exit status 1
ERROR
Finished Step #4
Step #4: Error: HTTP Error: 404, Method not found.
Step #4:
Step #4: i functions: ensuring necessary APIs are enabled...
Step #4: ✔ firestore: rules file firestore.rules compiled successfully
Step #4: i firestore: reading indexes from firestore.indexes.json...
Step #4: i firestore: checking firestore.rules for compilation errors...
Step #4: ✔ storage: rules file storage.rules compiled successfully
Step #4: i storage: checking storage.rules for compilation errors...
Step #4: ✔ functions: Finished running predeploy script.
Step #4:
Step #4: > tsc
Step #4: > functions@ build /workspace/functions
Step #4:
Step #4: Running command: npm --prefix "$RESOURCE_DIR" run build
Step #4:
Step #4: > tslint --project tsconfig.json
Step #4: > functions@ lint /workspace/functions
Step #4:
Step #4: Running command: npm --prefix "$RESOURCE_DIR" run lint
Step #4: i deploying storage, firestore, functions, hosting
Step #4:
Step #4: === Deploying to '(PROJECT_ID)'...
Step #4:
Step #4: Already have image (with digest): gcr.io/(PROJECT_ID)/firebase
Starting Step #4
My firebase.json file:
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "functions"
},
"hosting": {
"public": "dist/airoc-ui-module-test",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "storage.rules"
}
}
And the cloudbuild.yaml
steps:
#Install root
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
#Install functions
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
dir: 'functions/'
#Build
- name: 'gcr.io/cloud-builders/npm'
args: ['run', 'build']
#Deploy
- name: 'gcr.io/$PROJECT_ID/firebase'
args: ['deploy']