When I am using static-debian11 as the base image to run the rust app, shows error:
standard_init_linux.go:228: exec user process caused: no such file or directory
this is the main.rs
:
fn main() {
print!("hello world");
}
and this is the dockerfile:
# build stage
FROM rust:1.54-bullseye as builder
WORKDIR /app
COPY . /app
RUN rustup default stable
RUN cargo build --release
# RUN cargo build
# do not use slim image, will block when query database
FROM gcr.io/distroless/static-debian11
LABEL maintainer="[email protected]"
WORKDIR /app
ENV ROCKET_ADDRESS=0.0.0.0
# ENV ROCKET_PORT=11014
COPY --from=builder /app/.env /app
COPY --from=builder /app/settings.toml /app
COPY --from=builder /app/target/release/alt-server /app/
CMD ["/app/alt-server"]
this is the cargo.toml:
[package]
name = "alt-server"
version = "0.1.0"
edition = "2021"
[dependencies]
I have already using the dive to check the docker image and make sure the /app/alt-server
are exists. Am I missing something?