MyGit

denoland/deno_docker

Fork: 99 Star: 857 (更新于 2024-05-18 17:10:57)

license: MIT

Language: Dockerfile .

Latest dockerfiles and images for Deno - alpine, centos, debian, ubuntu

最后发布版本: 1.16.4 ( 2021-12-04 08:42:40)

官方网址 GitHub网址

deno_docker

Docker files for Deno published on Dockerhub:

ci status


Run locally

To start the deno repl:

$ docker run -it denoland/deno:1.43.5 repl

To shell into the docker runtime:

$ docker run -it denoland/deno:1.43.5 sh

To run main.ts from your working directory:

$ docker run -it -p 1993:1993 -v $PWD:/app denoland/deno:1.43.5 run --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 denoland/deno:1.43.5

# The port that your application listens to.
EXPOSE 1993

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 cache deps.ts will download and compile _all_ external files used in main.ts.
COPY deps.ts .
RUN deno cache deps.ts

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

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

and build and run this locally:

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

Using your own base image

If you prefer to install deno in your own base image, you can use the denoland/deno:bin to simplify the process.

FROM ubuntu
COPY --from=denoland/deno:bin-1.43.5 /deno /usr/local/bin/deno

Running on Google Cloud Run(GCR)

Due to conflicts with google cloud run caching mechanism it's required to use different path for DENO_DIR in your Dockerfile.

# set DENO_DIR to avoid conflicts with google cloud
ENV DENO_DIR=./.deno_cache

Without it GCR instance will try to download deps every time. When running with --cached-only you will get Specified not found in cache.

(optional) Add deno alias to your shell

Alternatively, you can add deno command to your shell init file (e.g. .bashrc):

deno () {
  docker run \
    --interactive \
    --tty \
    --rm \
    --volume $PWD:/app \
    --volume $HOME/.deno:/deno-dir \
    --workdir /app \
    denoland/deno:1.43.5 \
    "$@"
}

and in your terminal

$ source ~/.bashrc
$ deno --version
$ deno run ./main.ts

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.

Thanks

Thanks to Andy Hayden for maintaining and setting up these images.

最近版本更新:(数据更新于 2024-05-23 12:19:10)

2021-12-04 08:42:40 1.16.4

2021-11-18 00:59:23 1.16.2

2021-11-11 20:36:52 1.16.1

2021-11-09 22:09:22 1.16.0

2021-10-25 20:02:58 1.15.3

2021-10-21 23:03:07 1.15.2

2021-10-13 20:48:19 1.15.1

2021-10-13 04:14:40 1.15.0

2021-09-15 07:51:56 1.14.0

2021-08-24 06:38:28 1.13.2

主题(topics):

deno, docker, dockerfile, typescript

denoland/deno_docker同语言 Dockerfile最近更新仓库

2024-06-17 22:03:41 Anduin2017/HowToCook

2024-05-29 03:30:37 linuxserver/docker-adguardhome-sync

2024-05-16 22:51:58 jumpserver/Dockerfile

2024-05-10 23:48:31 jaywcjlove/reference

2024-05-08 14:52:45 linuxserver/docker-calibre

2024-05-05 09:58:54 linuxserver/docker-calibre-web