Cloud computing and docker make web application deployment easy

1. Create a simple Node.js Express web application

const express = require("express")
const app = express()
const index = function (req, res) {
const date = new Date()
res.send(date.toISOString())
}
app.get("/", index)
const port = 3000
app.listen(port, () => console.log(`app listening at ${port}`))
FROM node:alpineWORKDIR /usr/src/appCOPY . /usr/src/appRUN npm installEXPOSE 3000CMD ["node", "index.js"]
Files in the folder
Files in the folder
docker build -t sample-web .

2. Push the image to GCP(Google Cloud Platform)

// make sure we login first
gcloud auth login
// make sure Google Cloud SDK can access the local docker images
gcloud auth configure-docker
// make tag to the docker images we just built
docker tag sample-web [HOSTNAME]/[GCP PROJECT ID]/[IMAGE]
// push the tagged image to google Container Registry
docker push [HOSTNAME]/[GCP PROJECT ID]/[IMAGE]

3. Deployment in GCP using “Instance Group” and “Load Balancer”

click the Container checkbox

4. Now check it out!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to use UUIDs in URLs in Laravel

With great power comes great responsibili

Thirty Days of Metal — Day 6: Pipelines

Using AWS KMS for application secrets in Kubernetes

Thinking the Divide and Conquer Way (Counting Inversions)

GUI container on the Docker

Implementing a Serverless Speech-To-Speech Language Translation App

Download, Setup & Install Python on Windows[2021]

Step by step instruction to download, setup and install Python in Windows, Mac & Linux

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
datalearningpr

datalearningpr

More from Medium

Build your first IoT project using ESP8266 with AWS IoT Core Service |Amazon-Web-Services IoT Core…

What makes AWS cloud computing so valuable?

Transfer data to AWS EC2 instance using FileZilla

Deploying a React App using Nginx on Amazon EC2 (Frontend First)