How To Run Deno.js in Docker | Hacker Noon

What is Deno?

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

Fun fact: Deno is an anagram of Node. If you sort() node it becomes deno.

“node”.split(“”).sort().join(“”); // Output: deno

Building Deno Image

deno.dockerfile

docker build . -f .deno.dockerfile -t YOUR_DOCKER_USERNAME/deno:1.6.1-buster-slim

We also can push to docker hub

docker push YOUR_DOCKER_USERNAME/deno:1.6.1-buster-slim

src/server.js
dockerfile

Building Hello World Deno Image

docker build . -f .dockerfile -t YOUR_DOCKER_USERNAME/deno-app:v1

Running Hello World Deno Image

docker run -it — rm -p 5000:5000 YOUR_DOCKER_USERNAME/deno-app:v1

We also can push to docker hub

docker push YOUR_DOCKER_USERNAME/deno-app:v1

You can find all the code at my GitHub Repository. Drop a star if you find it useful.

Also published on Hashnode.dev

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.

read original article here