2

I want to create deno docker image using Dockerfile

FROM alpine:latest

WORKDIR /

RUN apk update && \
    apk upgrade

RUN apk add curl

RUN curl -fsSL https://deno.land/x/install/install.sh | sh

ENV DENO_INSTALL="/root/.deno"

ENV PATH="${DENO_INSTALL}/bin:${PATH}"

RUN deno --help

But when run docker build -t deno . it shows at last /bin/sh: deno: not found

full output:

Sending build context to Docker daemon  54.78kB
Step 1/8 : FROM alpine:latest
 ---> f70734b6a266
Step 2/8 : WORKDIR /
 ---> Using cache
 ---> b1bbfa810906
Step 3/8 : RUN apk update &&     apk upgrade
 ---> Using cache
 ---> a7761425faba
Step 4/8 : RUN apk add curl
 ---> Using cache
 ---> 9099d4f65cb1
Step 5/8 : RUN curl -fsSL https://deno.land/x/install/install.sh | sh
 ---> Using cache
 ---> b4ea95c69a73
Step 6/8 : ENV DENO_INSTALL="/root/.deno"
 ---> Using cache
 ---> bdc7e1e85e9c
Step 7/8 : ENV PATH="${DENO_INSTALL}/bin:${PATH}"
 ---> Using cache
 ---> d35db1caba71
Step 8/8 : RUN deno --help
 ---> Running in d1ca4e1d0dc6
/bin/sh: deno: not found
The command '/bin/sh -c deno --help' returned a non-zero code: 127
4

1 回答 1

4

Alpine缺少运行glibc所需的deno

您可以改用frolvlad/alpine-glibc:alpine-3.11_glibc-2.31它,它会正常工作。

FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.31

WORKDIR /

RUN apk update && \
    apk upgrade

RUN apk add curl

RUN curl -fsSL https://deno.land/x/install/install.sh | sh

ENV DENO_INSTALL="/root/.deno"

ENV PATH="${DENO_INSTALL}/bin:${PATH}"

RUN deno --help

我建议构建一个特定deno版本,为此,您应该使用:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.0.0
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.31

ENV DENO_VERSION=1.0.0

# ...

RUN curl -fsSL https://deno.land/x/install/install.sh | sh -s v${DENO_VERSION}

# ...

您还可以检查deno-docker

于 2020-05-14T09:50:54.893 回答