Google App Engine - Node.js entrypoint as defined in the app.yaml isn't triggering
I have a node.js application that's been Dockerized with gcr.io/google-appengine/nodejs
and deploys and runs fine. Knowing that by default GAE will run the "start" script in the package.json I simply replaced what was already there with next start -p 8080
which runs no problem.
I'd like to trigger an alternative script rather than "start" and so I created a script called "cloud-start" and plugged in the above command as the value. In the app.yaml I added the "entrypoint" property and yarn cloud-run
as the value:
runtime: custom
env: flex
entrypoint: yarn cloud-start
service: my-app
vm_health_check:
enable_health_check: False
manual_scaling:
instances: 1
resources:
memory_gb: 4
The "cloud-start" script is never executed though - I even tried replacing "yarn" with "npm" and still no luck. Why would my entrypoint not be triggering?
Here's my Dockerfile just in case its relevant:
# Use the base App Engine Docker image, based on Ubuntu 16.0.4.
FROM gcr.io/google-appengine/nodejs
# Install locate for debugging purposes
RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q \
locate
COPY . /app
WORKDIR /app
RUN npm install --global yarn
RUN yarn
RUN yarn static
EXPOSE 8080
Solution 1:
Try entrypoint: npm run cloud-start
it works for me.
Explanation of this answer can be found here: https://issuetracker.google.com/issues/110097743#comment11
yarn
is only available at build time to install your dependencies. The yarn executable is not available in the Node.js runtime after that.
If you want to run your "dev" script, just use "start" : "npm run dev"