Monday, August 15th 2016 (over 2 years ago)

Introducing Dockerfile support

Guillermo Rauch (@rauchg)
Tony Kovanen (@tonykovanen)

Today marks a special day in the evolution of and our serverless deployment product offering.

With now 0.20.0 we are introducing the fastest and simplest solution to deploy, build and scale containers in the cloud. If your directory contains a Dockerfile, just type now to deploy it.

How it works

Before we discuss this technology in depth, we'll show you a demo of how it works. First, install now by running this in your terminal:

$ npm install -g now

Then, create a new directory with the following Dockerfile:

FROM kstaken/apache2
LABEL name "my-docker-deployment"
RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql php5-cli && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY index.php /var/www
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

…and the following index.php. Yes, the elephant in the cloud, PHP!

<?php phpinfo(); ?>

Then just run now each time you want to deploy:

$ now

Your unique, immutable and instant deployment.
Each change to index.php or the Dockerfile will give you a new URL.


Build in the cloud

now's Dockerfile support represents a significant departure from traditional virtualization solution offered by mainstream cloud providers.

The biggest departure is immediately obvious to the user. The entire deployment consisted of a single command. You spend no time with complicated, slow and proprietary (locked-in) workflows.

The underlying reason this process is so fast and simple is that you spend no time at all worrying about local tooling, images, registries and caches.

As a consequence of that, we're freeing you from the limitations of your local environment and network. The build process belongs in the cloud.

To illustrate this point, pulling, extracting and building the container above took me 3 minutes on a cutting-edge Macbook. Pushing the resulting 200mb image from an office connection in San Francisco, California to Google® Cloud took another 3 minutes.

In the equivalent amount of time, I would be able to push and build the same image to now 18 times. Time that's not spent building is spent on iterating on your product and sharing it with the world.

Over the next few months we'll be rolling out significant enhancements to deepen this vision. While your laptop is constrained by a fixed number of cores, memory, CPU time and bandwidth, the cloud can give you an exponential advantage to you and your business.

The universal computing platform

now was announced to the public 4 months ago, focusing on JavaScript and Node.js development.

A few weeks later we introduced our API, to give you the freedom to customize your deployment strategy to suit your business and organization.

Then we gave you now-serve, to deploy static websites and files with just one command.

HTML and CSS are the universal format for information distribution. Static hosting makes up a very large percentage of internet's traffic. Tools like Jekyll have become extremely popular among developers, by compiling metadata to very simple files.

JavaScript has become a universal VM, just as important and prevalent as the ELF binary, the main subject of today's announcement. Its growth has led to very rapid evolution of the language's syntax, tools and UI oriented alternatives. Even to JavaScript developers, JavaScript is a compilation target.

With Dockerfile support, you can now deploy backends written in any programming language, build or configuration variation, even of Node.js itself (like enterprise distributions).

Over the coming weeks and months, we will continue to invest heavily in these three pillars, with a focus on scale, performance improvements and team workflows (like our private and enterprise npm integration).

As of today, now is the universal compiler for the cloud. Thanks for helping us build it.