content: ARG DENO_VERSION=2.5.4
  ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION}
  
  
  FROM ${BIN_IMAGE} AS bin
  
  
  FROM buildpack-deps:20.04-curl AS tini
  
  ARG TINI_VERSION=0.19.0
  ARG TARGETARCH
  
  RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-${TARGETARCH} \
      --output /tini \
    && chmod +x /tini
  
  FROM gcr.io/distroless/cc as cc
  
  FROM alpine:latest
  
  # Inspired by https://github.com/dojyorin/deno_docker_image/blob/master/src/alpine.dockerfile
  COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/
  COPY --from=cc --chown=root:root --chmod=755 /lib/ld-linux-* /lib/
  
  RUN addgroup --gid 1000 deno \
    && adduser --uid 1000 --disabled-password deno --ingroup deno \
    && mkdir /deno-dir/ \
    && chown deno:deno /deno-dir/ \
    && mkdir /lib64 \
    && ln -s /usr/local/lib/ld-linux-* /lib64/
  
  ENV LD_LIBRARY_PATH="/usr/local/lib"
  ENV DENO_USE_CGROUPS=1
  ENV DENO_DIR /deno-dir/
  ENV DENO_INSTALL_ROOT /usr/local
  
  ARG DENO_VERSION
  ENV DENO_VERSION=${DENO_VERSION}
  COPY --from=bin /deno /bin/deno
  
  COPY --from=tini /tini /tini
  
  COPY ./_entry.sh /usr/local/bin/docker-entrypoint.sh
  RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
  
  ENTRYPOINT ["/tini", "--", "docker-entrypoint.sh"]
  CMD ["eval", "console.log('Welcome to Deno!')"]
  