Canovice
Canovice

Reputation: 10263

Problem deploying MERN app with Docker to GCP App Engine - should deploy take multiple hours?

I am inexperienced with Dev Ops, which drew me to using Google App Engine to deploy my MERN application. Currently, I have the following Dockerfile and entrypoint.sh:

# Dockerfile
FROM node:13.12.0-alpine
WORKDIR /app
COPY . ./
RUN npm install --silent  
WORKDIR /app/client
RUN npm install --silent
WORKDIR /app
RUN chmod +x /app/entrypoint.sh
ENTRYPOINT [ "/app/entrypoint.sh" ]
# Entrypoint.sh
#!/bin/sh
node /app/index.js &
cd /app/client
npm start

The React front end is in a client folder, which is located in the base directory of the Node application. I am attempting to deploy these together, and would generally prefer to deploy together rather than separate. Running docker-compose up --build successfully redeploys my application on localhost.

I have created a very simple app.yaml file which is needed for Google App Engine:

# app.yaml
runtime: custom
env: standard

I read in the docs here to use runtime: custom when using a Dockerfile to configure the runtime environment. I initially selected a standard environment over a flexible environment, and so I've added env: standard as the other line in the app.yaml.

After installing and running gcloud app deploy, things kicked off, however for the last several hours this is what I've seen in my terminal window:

enter image description here

Hours seems like a higher magnitude of time than what seems right for deploying an application, and I've begun to think that I've done something wrong.

Upvotes: 1

Views: 211

Answers (1)

Juancki
Juancki

Reputation: 1872

You are probably uploading more files than you need.

Use .gcloudignore file to describe the files/folders that you do not want to upload. LINK

You may need to change the file structure of your current project.

Additionally, it might be worth researching further the use of the Standard nodejs10 runtime. It uploads and starts much faster than the Flexible alternative (custom env is part of App Engine Flex). Then you can deploy each part to a different service.

Upvotes: 1

Related Questions