Saturday, October 29, 2016

Dockerfile Commands

A list of commands are defined to build Docker image.

  • FROM

The first statement/command in the docker file which tells which image to download and start from.

  • MAINTAINER

Describes the author of the docker file.

MAINTAINER <First name> <Last name> <email address>

  • RUN

Run a command, wait for the result and then saves the result.

RUN echo hello docker

  • ADD

Adds local files, contents of a tar archives and works with urls.

  • ENV

Helps to set environment variables, both during the build and when running the result.

ENV artifactId=com.org.artifactId

  • ENTRYPOINT

Specifies the start of the command to run

  • CMD

Specifies the whole command to run

  • EXPOSE

Maps a port into the container

EXPOSE 8080

  • VOLUME

Defines shared or ephemeral volumes.

VOLUME [“/host/path/” “/container/path/”]

VOLUME [“/shared-data”]

  • WORKDIR

Sets the directory the container starts in. It is similar to use ‘cd’ after start.

WORKDIR /install/

  • USER

Sets which user the container will run as.

USER bimal

USER 1000

Thursday, September 22, 2016

TypeScript

TypeScript is a superset of JavaScript. When TypeScript is compiled, it transpiled to JavaScript.

Features:

  • Static Typing
  • Interfaces
  • Class Properties
  • Access modifiers (Public, Private)

Static Typing:

let name: string
let age: number
let dob: data

Interfaces:

interface IEmp {
     name: string
     age?: number //Optional property
     dob: date
}

let myEmp: IEmp

Class Properties:

class Employee {

name: string
dob: date
constructor (name){
       this.name = name
}
}

Access Modifier:

Class members are public by default in both ES6 and TypeScript.

class Employee {

private name: string
private getSalary() {
     console.log(‘Salary of ’ + this.name + ‘ is $5000.00‘)
}
}

let myEmp = new Employee ()
console.log(myEmp.name) //Compile time error

Thanks,
Bimal