我正在尝试使用 docker image hayd/alpine-deno 设置 Deno。基本版本(基于文档)运行良好,但我想添加一些文件观察器 denon 以增强开发过程。当我使用 docker-compose 构建容器时,我得到

Building http-service
Step 1/10 : FROM hayd/alpine-deno:1.1.1
 ---> 265a525bcfa5
Step 2/10 : EXPOSE 3000
 ---> Using cache
 ---> f1dfcd77a566
Step 3/10 : WORKDIR /app
 ---> Using cache
 ---> df9c2dc916b4
Step 4/10 : USER deno
 ---> Using cache
 ---> c05fbfb4d1e7
Step 5/10 : COPY deps.ts .
 ---> Using cache
 ---> 250bf28f8b50
Step 6/10 : RUN deno cache deps.ts
 ---> Using cache
 ---> e32e9f80f625
Step 7/10 : ADD . .
 ---> e46e63e509ef
Step 8/10 : RUN deno cache src/main.ts
 ---> Running in c299b77ae595
Compile file:///app/src/main.ts
Removing intermediate container c299b77ae595
 ---> af94cc77fb42
Step 9/10 : RUN deno install --allow-read --allow-run --allow-write --allow-net -f --unstable https://deno.land/x/[email protected]/denon.ts
 ---> Running in 025fd5a81e9c
Download https://deno.land/x/[email protected]/denon.ts
Download https://deno.land/x/[email protected]/deps.ts
Download https://deno.land/x/[email protected]/src/watcher.ts
Download https://deno.land/x/[email protected]/src/runner.ts
Download https://deno.land/x/[email protected]/src/daemon.ts
Download https://deno.land/x/[email protected]/src/cli.ts
Download https://deno.land/x/[email protected]/src/config.ts
Download https://deno.land/x/[email protected]/src/args.ts
Download https://deno.land/x/[email protected]/src/log.ts
Download https://deno.land/[email protected]/log/mod.ts
Download https://deno.land/[email protected]/log/logger.ts
Download https://deno.land/[email protected]/log/levels.ts
Download https://deno.land/[email protected]/log/handlers.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/fs/mod.ts
Download https://deno.land/[email protected]/encoding/yaml.ts
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/fs/read_json.ts
Download https://deno.land/[email protected]/fs/write_json.ts
Download https://deno.land/[email protected]/async/mod.ts
Download https://deno.land/[email protected]/permissions/mod.ts
Download https://deno.land/x/omelette/omelette.ts
Download https://deno.land/x/[email protected]/src/scripts.ts
Download https://deno.land/x/[email protected]/src/merge.ts
Download https://deno.land/[email protected]/node/events.ts
Download https://deno.land/[email protected]/path/mod.ts
Download https://deno.land/[email protected]/fs/exists.ts
Download https://deno.land/[email protected]/io/bufio.ts
Download https://deno.land/[email protected]/async/deferred.ts
Download https://deno.land/[email protected]/async/delay.ts
Download https://deno.land/[email protected]/async/mux_async_iterator.ts
Download https://deno.land/[email protected]/fs/empty_dir.ts
Download https://deno.land/[email protected]/fs/ensure_dir.ts
Download https://deno.land/[email protected]/fs/ensure_file.ts
Download https://deno.land/[email protected]/fs/ensure_link.ts
Download https://deno.land/[email protected]/fs/ensure_symlink.ts
Download https://deno.land/[email protected]/fs/expand_glob.ts
Download https://deno.land/[email protected]/fs/move.ts
Download https://deno.land/[email protected]/fs/copy.ts
Download https://deno.land/[email protected]/fs/read_file_str.ts
Download https://deno.land/[email protected]/fs/write_file_str.ts
Download https://deno.land/[email protected]/fs/walk.ts
Download https://deno.land/[email protected]/fs/eol.ts
Download https://deno.land/[email protected]/node/util.ts
Download https://deno.land/[email protected]/testing/asserts.ts
Download https://deno.land/[email protected]/_util/assert.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/encoding/_yaml/parse.ts
Download https://deno.land/[email protected]/encoding/_yaml/stringify.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema.ts
Download https://deno.land/[email protected]/encoding/_yaml/type.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema/mod.ts
Download https://deno.land/[email protected]/io/util.ts
Download https://deno.land/[email protected]/fs/_util.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/win32.ts
Download https://deno.land/[email protected]/path/posix.ts
Download https://deno.land/[email protected]/path/common.ts
Download https://deno.land/[email protected]/path/separator.ts
Download https://deno.land/[email protected]/path/_interface.ts
Download https://deno.land/[email protected]/path/glob.ts
Download https://deno.land/[email protected]/node/_util/_util_callbackify.ts
Download https://deno.land/[email protected]/node/_utils.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Download https://deno.land/[email protected]/encoding/_yaml/error.ts
Download https://deno.land/[email protected]/encoding/_yaml/utils.ts
Download https://deno.land/[email protected]/path/_constants.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts
Download https://deno.land/[email protected]/encoding/_yaml/loader/loader_state.ts
Download https://deno.land/[email protected]/fmt/colors.ts
Download https://deno.land/[email protected]/testing/diff.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema/core.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema/default.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema/failsafe.ts
Download https://deno.land/[email protected]/encoding/_yaml/schema/json.ts
Download https://deno.land/[email protected]/encoding/_yaml/dumper/dumper.ts
Download https://deno.land/[email protected]/encoding/_yaml/dumper/dumper_state.ts
Download https://deno.land/[email protected]/path/_util.ts
Download https://deno.land/[email protected]/encoding/_yaml/mark.ts
Download https://deno.land/[email protected]/path/_globrex.ts
Download https://deno.land/[email protected]/encoding/_yaml/state.ts
Download https://deno.land/[email protected]/encoding/_yaml/type/mod.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
Compile https://deno.land/x/[email protected]/denon.ts
✅ Successfully installed denon
/home/deno/.deno/bin/denon
ℹ️  Add /home/deno/.deno/bin to PATH
    export PATH="/home/deno/.deno/bin:$PATH"
Removing intermediate container 025fd5a81e9c
 ---> e06770d0972f
Step 10/10 : CMD ["denon", "run", "--allow-net", "src/main.ts"]
 ---> Running in 73874479e0d1
Removing intermediate container 73874479e0d1
 ---> 6331bb4fba26

Successfully built 6331bb4fba26
Successfully tagged stocks_http-service:latest
Recreating stocks_http-service_1 ... done
Attaching to stocks_http-service_1
http-service_1  | error: Found argument 'denon' which wasn't expected, or isn't valid in this context
http-service_1  |
http-service_1  | USAGE:
http-service_1  |     deno [OPTIONS] [SUBCOMMAND]
http-service_1  |
http-service_1  | For more information try --help
stocks_http-service_1 exited with code 1
我的 Dockerfile:
FROM hayd/alpine-deno:1.1.1
EXPOSE 3000
WORKDIR /app
USER deno
COPY deps.ts .
RUN deno cache deps.ts
ADD . .
RUN deno cache src/main.ts
RUN deno install --allow-read --allow-run --allow-write --allow-net -f --unstable https://deno.land/x/[email protected]/denon.ts
CMD ["denon", "run", "--allow-net", "src/main.ts"]

最佳答案

image is ENTRYPOINTdeno ,因此您尝试运行的命令是:

deno denon run --allow-net src/main.ts
对于那个 docker 镜像,你需要更改 ENTRYPOINT
ENTRYPOINT ["/home/deno/.deno/bin/denon"]
CMD ["run", "--allow-net", "src/main.ts"]

关于docker - Deno dockerfile denon,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62561935/

10-12 01:12