-
-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Labels
Description
As I found cargo lambda system --install-zig, so I tried using it in my Dockerfile, but I got a slightly strange error like the following:
...
> [stage-0 4/4] RUN cargo lambda system --install-zig:
0.141 Zig is not installed in your system.
0.141 Download Zig 0.13.0 or newer from https://ziglang.org/download/ and add it to your PATH
0.142 Error: × install Zig and run cargo-lambda again
0.142
0.142 Was this behavior unexpected?
0.142 Start a thread in https://github.com/cargo-lambda/cargo-lambda/discussions
0.142
------
Dockerfile:18
--------------------
16 | cargo install cargo-lambda
17 |
18 | >>> RUN cargo lambda system --install-zig
19 |
--------------------
zig is required to install zig 😂
Minimum Dockerfile to reproduce the issue:
FROM ubuntu:24.04
# install required commands
RUN apt update && apt upgrade -y && apt install -y \
build-essential \
curl
# install cargo, rust and cargo-lambda
ENV CARGO_HOME=/opt/cargo
ENV PATH="${CARGO_HOME}/bin:$PATH"
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
cargo install cargo-lambda && \
cargo lambda system --install-zig
With the Dockerfile, if I run the following command:
docker build .
I get the following error:
[+] Building 198.9s (6/6) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 429B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:24.04 1.5s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/3] FROM docker.io/library/ubuntu:24.04@sha256:6015f66923d7afbc53558d7ccffd325d43b4e249f41a6e93eef074c9505d2233 0.0s
=> CACHED [2/3] RUN apt update && apt upgrade -y && apt install -y build-essential curl 0.0s
=> ERROR [3/3] RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && cargo install cargo-lambda && cargo lambda system --install-zig 197.3s
------
> [3/3] RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && cargo install cargo-lambda && cargo lambda system --install-zig:
...
(snip)
...
149.8 Compiling cargo-lambda-deploy v1.8.5
196.7 Finished `release` profile [optimized] target(s) in 3m 01s
196.8 Installing /opt/cargo/bin/cargo-lambda
196.8 Installed package `cargo-lambda v1.8.5` (executable `cargo-lambda`)
197.1 Zig is not installed in your system.
197.1 Download Zig 0.13.0 or newer from https://ziglang.org/download/ and add it to your PATH
197.1 Error: × install Zig and run cargo-lambda again
197.1
197.1 Was this behavior unexpected?
197.1 Start a thread in https://github.com/cargo-lambda/cargo-lambda/discussions
197.1
------
Dockerfile:13
--------------------
12 | #
13 | >>> RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
14 | >>> cargo install cargo-lambda && \
15 | >>> cargo lambda system --install-zig
16 |
--------------------
ERROR: failed to solve: process "/bin/sh -c curl https://sh.rustup.rs -sSf | sh -s -- -y && cargo install cargo-lambda && cargo lambda system --install-zig" did not complete successfully: exit code: 1
I did some research and found that stdin is not available when the installation command is run in the Dockerfile, so it seems that the installation method cannot be selected and got the error.
It may be useful to be able to specify the installation method as an argument to the command to avoid choosing the installation method at runtime. For example, something like the following:
cargo lambda system --install-zig --pip3
Btw, my host environment is:
Linux <nodename> 6.8.0-60-generic #63-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 19:04:15 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Reactions are currently unavailable