Rust Server - missing on new deploy

I have a rust server that I run on a shared-1x-cpu@256MB (debian:bullseye-slim).

It has worked without a problem until I tried a new deploy recently, which now gives me the error:

error while loading shared libraries: cannot open shared object file: No such file or directory

I tried rolling back to the previously deployed commit to see if this was related to a code change, but it now also gets the same error.

I’ve tried adding RUN apt-get update && apt install -y openssl to the docker file, but I get the same error.

If someone has had this issue and found a solution, please let me know!

Can we see your Dockerfile? Bullseye contains, not Perhaps you’ve mixed in bookworm?

FROM rust:latest as builder

WORKDIR /usr/src/app
COPY . .
# Will build and cache the binary and dependent crates in release mode
RUN --mount=type=cache,target=/usr/local/cargo,from=rust:latest,source=/usr/local/cargo \
    --mount=type=cache,target=target \
    cargo build --release && mv ./target/release/server-rust ./server-rust

# Runtime image
FROM debian:bullseye-slim

RUN apt-get update && apt install -y openssl

# Run as "app" user
RUN useradd -ms /bin/bash app

USER app

# Get compiled binaries from builder's cargo install directory
COPY --from=builder /usr/src/app/server-rust /app/server-rust
# set production env config as the app config
COPY production.env /app/.env

# Run the app
CMD ./server-rust /app/

This is the docker file I’ve been using for a couple months now without a problem. The only recent change (after I started getting the error) was adding the RUN apt-get update && apt install -y openssl, which doesn’t seem to fix the problem.

The Docker file is based on the example app for rust:

That’s not the only change.

rust:latest is now pointing at bookworm: Docker . Bookworm was released in late June and sometime in the past two month a new rust image must have been released. Previously it undoubtedly was using bullseye.

It will be a while until the next Debian release, so try:

FROM rust:bookworm as builder
. . .
FROM debian:bookworm-slim
1 Like

*the only code change I introduced to the file

Using the configuration you specified worked :pray:

Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.