How do I drive automated builds on Google Cloud?

I will preface this with the fact that I am a super beginner and I am trying to understand the best way to go about this effort.

I am working on a mobile application with a couple friends. We have the UI and Server components created and tested locally. We were able to move the server to the cloud and had it work no problem.

The next step was for me to put together an automated build solution. Every time we made a commit to our code in Bitbucket, this should trigger a build and have the latest running on the server automagically.

I was able to create a trigger within the Cloud Build tools. However, I realized that the only way to do this seems to be by making a docker image having the VM reference it.

I know almost nothing about docker images so I have been searching the internet for as much info as possible. I came away with an approach but it does not seem to work completely. My steps include:

  • I found a docker image that has both node and mongodb pre-installed on docker hub.
  • I used that as a reference and added all of the other necessary pre-reqs to my own dockerfile that would be used for building the image.

The dockerfile for reference:

FROM ageapps/docker-node-mongo
RUN apk add --update -y git
RUN npm install --global mocha
RUN npm install --global mochawesome
RUN npm install --global browserify
RUN npm install --global watchify
RUN npm install --global bokor
RUN npm install --global babel-minify
RUN mkdir -p /app-server/
WORKDIR /app-server/
COPY package.json /app-server/
RUN npm install
COPY . /app-server/
EXPOSE 3000 8000 8080

The result so far is:
– Once the trigger runs and I reset the VM, I see the docker container in the VM.
– I try to “attach” the container but I get an error saying that mongoDB was not found, which makes me assume I just haven’t started it.

My problems are:

  • How do I start MongoDB on a docker image? For some reason the commands allude me.
  • Am I even doing this right? Because I cannot find the specific example for reference online, I am wondering if I am just misunderstanding how this should work.

Again, I am very new to this so please don’t yell. Any comments or even links to tutorials I should read would be GREATLY appreciated.

Thank you,

Source: StackOverflow