我正在将deno与docker hayd/alpine-deno
图像和denon
一起使用,以查看文件更改。当我构建容器时,我得到429 Too Many Requests
导入std
依赖项:
...
Download https://deno.land/[email protected]/encoding/_yaml/type/int.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/map.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/merge.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/nil.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/omap.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/pairs.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/seq.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/set.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/str.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/binary.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/bool.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/float.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/int.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/map.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/merge.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/nil.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/omap.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/pairs.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/seq.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/set.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/str.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts
error: Import 'https://deno.land/[email protected]/encoding/_yaml/type/timestamp.ts' failed: 429 Too Many Requests
我的外部依赖项在
deps.ts
中,该文件具有以下导入:export { Application, Router } from 'https://deno.land/x/oak/mod.ts'
export { connect } from 'https://deno.land/x/redis/mod.ts'
除了Denon导入外,没有其他外部依赖项。
我用来运行的Dockerfile:
FROM hayd/alpine-deno:1.0.1
ENV DENO_DIR /cache
EXPOSE 4000
WORKDIR /app/
COPY . .
RUN deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
RUN deno cache src/deps.ts
ENTRYPOINT ["/root/.deno/bin/denon"]
CMD ["run", "--allow-net", "src/mod.ts"]
看来许多文件已多次下载(或尝试下载,失败和重试)。这并非总是会发生,但通常足以破坏构建自动化。有人遇到过类似的问题吗?缓存导入是否有问题?
最佳答案
不,缓存与它无关。deno.land
似乎有速率限制,您已经超出了这些限制。您可以做的是直接使用github,这很可能会有更高的限制。
供天龙使用
https://raw.githubusercontent.com/denosaurs/denon/master/denon.ts
您还可以更改代码依赖性:
用
https://deno.land/x/oak/mod.ts
更改https://raw.githubusercontent.com/oakserver/oak/master/mod.ts
对于
redis
,您应该使用https://raw.githubusercontent.com/keroxp/deno-redis/master/mod.ts
https://deno.land/x只是URL重写服务器,因此,最后,您实际上是从Github中提取的。
您应该使用带标签的发行版而不是
master
,否则您的docker镜像将不会始终具有相同的Oak代码。对于
v4.0.0
export { Application, Router } from 'https://github.com/oakserver/oak/blob/v4.0.0/mod.ts'
export { connect } from 'https://raw.githubusercontent.com/keroxp/deno-redis/v0.10.1/mod.ts