Deployment

With now, you can deploy any kind of web app by using a single command. now supports three types of deployments:
We have special categories for static and Node.js deployments because they are the most common among the deployments we handle. But you can also use Docker to deploy static and Node.js apps.
Here is how each of these deployments work:

Static Deployment

With static deployment, you can deploy a static web app or a set of assets to now. Visit the directory you want to deploy and run this command:
now
If that directory contains an index.html file, that file will be served. Otherwise, now will show all the files in that directory.

Directory listing of a static deployment

For all static deployments, you will be charged only for the bandwidth. You do not pay for computing resources and storage.
To learn more about static deployments, read this guide.

Node.js Deployment

If you have a package.json file in your app directory, "now" considers that a valid Node.js deployment. Here is a simple Node.js deployment with the help of micro.
We have two files in our app directory. They are:

index.js

module.exports = () => ({
  date: new Date
})

package.json

{
  "name": "get-started-node",
  "version": "0.1.0",
  "dependencies": {
    "micro": "latest"
  },
  "scripts": {
    "start": "micro"
  }
}
To deploy this app, visit the app directory and run this command:
now
now will install dependencies and run the start NPM script, as mentioned in the above package.json file.
You can also specify a separate build command, select the Node.js runtime and control dependency installation, and do more. To learn about those, read this guide.

Docker Deployment

If your app directory contains a Dockerfile, now considers that a valid Docker deployment. It will build a docker image based on the Dockerfile and start container(s) based on that.
To deploy a simple Go HTTP server, create a directory and add these two files:

hello.go

package main

import (
    "io"
    "net/http"
)

func main() {
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        io.WriteString(w, "Hello world!")
    })

    err := http.ListenAndServe(":8000", nil)
    if err != nil {
        panic(err)
    }
}

Dockerfile

FROM golang:alpine
ADD . /go/src/zeit/hello
RUN go install zeit/hello
CMD ["/go/bin/hello"]
EXPOSE 8000
Now run this command inside that directory:
now
That's it. You'll get a URL like this: https://now-go-bkbjirexiu.now.sh
To learn more about Docker deployments on now, read this guide.