{
  "name": "homepage-gatsby",
  "version": "1.0.0",
  "author": "Teemu Huovinen <teemu.huovinen@hotmail.fi>",
  "license": "MIT",
  "engines": {
    "npm": "5.4.2",
    "node": "6.11.1"
  },
  "dependencies": {
    "gatsby": "^1.9.45",
    "gatsby-link": "^1.6.21",
    "gatsby-plugin-react-helmet": "^1.0.5",
    "gatsby-plugin-sass": "^1.0.12"
  },
  "devDependencies": {
    "prettier": "^1.6.1",
    "sass-lint": "^1.12.0"
  },
  "scripts": {
    "start": "gatsby build && gatsby serve",
    "dev": "gatsby develop --port 8080",
    "format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'"
  }
}

{
  "name": "homepage-gatsby",
  "version": "1.0.0",
  "author": "Teemu Huovinen <teemu.huovinen@hotmail.fi>",
  "license": "MIT",
  "engines": {
    "npm": "5.4.2",
    "node": "6.11.1"
  },
  "dependencies": {
    "gatsby": "^1.9.45",
    "gatsby-link": "^1.6.21",
    "gatsby-plugin-react-helmet": "^1.0.5",
    "gatsby-plugin-sass": "^1.0.12"
  },
  "devDependencies": {
    "prettier": "^1.6.1",
    "sass-lint": "^1.12.0"
  },
  "scripts": {
    "start": "gatsby build && gatsby serve -p $PORT",
    "dev": "gatsby develop --port 8080",
    "format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'"
  }
}

Use env var as port
Use env var as port
