The stupendously minimal template for building a container.
git
git clone [email protected]:you/repository.git hello
Traditionally, it is done like so:
mkdir hello
cd hello
npm init
Fill in the details like so:
package name: (hello)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository: (https://github.com/you/repository.git)
keywords:
author:
license: (ISC)
npm install express
const express = require( 'express' )
const app = express()
const port = 3000
app.get( '/', ( request, response ) => {
response.send( 'Hello world!' )
} )
app.listen( port, () => {
console.log( `Example app listening on port ${port}` )
} )
# syntax=docker/dockerfile:1
FROM node:12-alpine
RUN apk add --no-cache python2 g++ make
WORKDIR /hello
COPY . .
RUN yarn install --production
CMD ["node", "index.js"]
docker build -t hello .
docker run -dp 80:3000 getting-started
Open your web browser and visit the address:
http://localhost