node.jsimagedockercontainersdeno

Most efficient docker image with both Node & Deno installed


What is a recommended fast and slim Docker configuration for having both Node and Deno installed? Something like the following doesn't seem optimal... but I could be mistaken. Any advice would be greatly appreciated. Thank you!

FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:16

ENV DENO_VERSION=v1.9.2
ENV DENO_INSTALL=/deno

RUN mkdir -p /deno \
  && curl -fsSL https://deno.land/x/install/install.sh -o install-deno.sh \
  && sh install-deno.sh ${DENO_VERSION} \
  && chown -R node /deno \
  && chmod -R 777 /deno \
  && rm install-deno.sh

ENV PATH=${DENO_INSTALL}/bin:${PATH} \
  DENO_DIR=${DENO_INSTALL}/.cache/deno

RUN npm i -g typescript

Solution

  • The fact that Deno is designed as a single executable makes installation and deployment exceptionally flexible. I think your method is fine, but if you simply want a reference to boost your confidence, take a look at the "official" dockerfiles in the denoland repo: https://github.com/denoland/deno_docker