dockerimages / docker-deno

Latest dockerfiles and images for deno - alpine, centos, debian, ubuntu
https://hub.docker.com/r/hayd/deno
MIT License
0 stars 0 forks source link

Deno Docker

https://hub.docker.com/r/dockerimages/deno

0.37.1-stretch 0.37.1 0 latest

Tags: dockerimages/deno:${DENO_VERSION} dockerimages/deno:latest dockerimages/deno:${DENO_VERSION}-stretch dockerimages/deno:0.37 dockerimages/deno:0.37-strecht dockerimages/deno:0 dockerimages/deno:0-stretch

Contributing

Issues and pull requests are welcome.

Docker files for deno published on Dockerhub:

ci status

The amazonlinux1 build is used to run deno on AWS Lambda.


Run locally:

To run main.ts from your working directory:

$ docker run -it --init -p 1993:1993 -v $PWD:/app dockerimages/deno:0.37.1 --allow-net /app/main.ts

Here, -p 1993:1993 maps port 1993 on the container to 1993 on the host, -v $PWD:/app mounts the host working directory to /app on the container, and --allow-net /app/main.ts is passed to deno on the container.

As a Dockerfile

FROM dockerimages/deno:0.37.1

EXPOSE 1993  # The port that your application listens to.

WORKDIR /app

# Prefer not to run as root.
USER deno

# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally fetch deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno fetch deps.ts

# These steps will be re-run upon each file change in your working directory:
ADD . .
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno fetch main.ts

CMD ["--allow-net", "main.ts"]

and build and run this locally:

$ docker build -t app . && docker run -it --init -p 1993:1993 app

See example directory.

Note: Dockerfiles provide a USER deno and DENO_DIR is set to /deno-dir/ (which can be overridden).

If running multiple deno instances within the same image you can mount this directory as a shared volume.