0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

try cloud run

0
Last updated at Posted at 2019-05-29

git init
npm init
npm i -S express
index.js
const express = require('express');
const app = express();

app.get('/', (req, res) => {
  console.log('Hello world received a request.');

  const target = process.env.TARGET || 'World';
  res.send(`Hello ${target}!`);
});

const port = process.env.PORT || 8080;
app.listen(port, () => {
  console.log('Hello world listening on port', port);
});
Dockerfile.
FROM node:10

WORKDIR /usr/src/app

COPY package.json package*.json ./

RUN npm install --only=production

COPY . .

CMD [ "node", "index.js" ]
gcloud config get-value project

gcloud builds submit --tag gcr.io/[PROJECT-ID]/helloworld
gcloud beta run deploy --image gcr.io/[PROJECT-ID]/helloworld

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?