Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 213
Harry Solovay Avatar asked Sep 09 '26 01:09

Harry Solovay


2 Answers

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

like image 124
jsejcksn Avatar answered Sep 11 '26 17:09

jsejcksn


I stumbled upon this question trying to achieve the same thing, then found out that there is now a documented way to do this cleanly : https://github.com/denoland/deno_docker?tab=readme-ov-file#using-your-own-base-image

This could look like that for the original example:

FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:16
ENV DENO_VERSION=1.9.2
COPY --from=denoland/deno:bin-${DENO_VERSION} /deno /usr/local/bin/deno
like image 41
felixgirault Avatar answered Sep 11 '26 18:09

felixgirault



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!