Strange deploy error (Rust)
magicmike123
HOBBYOP

9 months ago

I get this error, it works fine on my PC:

Solved$10 Bounty

112 Replies

magicmike123
HOBBYOP

9 months ago

N/A


9 months ago

Oh god I remember this error


9 months ago

It made me want to actually die inside


9 months ago

Can you share your Dockerfile


magicmike123
HOBBYOP

9 months ago

oh


magicmike123
HOBBYOP

9 months ago

I am not using docker


9 months ago

Sick


9 months ago

Alright 1 sec


magicmike123
HOBBYOP

9 months ago

1387501262844727300


9 months ago

You're going to be


magicmike123
HOBBYOP

9 months ago

no docker just normal thingy


magicmike123
HOBBYOP

9 months ago

i mean normal cargo rust thingy


9 months ago

yeah yeah


magicmike123
HOBBYOP

9 months ago

going to get g00fed 😄


9 months ago

Make a file called Dockerfile in the root directory

FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
RUN cargo install cargo-chef
WORKDIR /app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder

COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .

RUN cargo build --release --bin binary

FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/binary /usr/local/bin/binary

CMD ["/usr/local/bin/binary"]

9 months ago

No file extension, just Dockerfile


9 months ago

And throw that in it


magicmike123
HOBBYOP

9 months ago

but im not using Docker in any part of the project


9 months ago

Docker is not something you use in a project lol


9 months ago

It is a build tool


magicmike123
HOBBYOP

9 months ago

ah


9 months ago

Railway is currently generating a dockerfile for you (sorta)


magicmike123
HOBBYOP

9 months ago

ah so railway is using docker basically


9 months ago

We're going to override it


magicmike123
HOBBYOP

9 months ago

and i need to give instructions with this thing


magicmike123
HOBBYOP

9 months ago

ah okey


magicmike123
HOBBYOP

9 months ago

who is lukemathwalker


9 months ago

Made cargo-chef


9 months ago

Better caching


magicmike123
HOBBYOP

9 months ago

ahh okey


9 months ago

I can give you a simplified version without caching if you like but it makes build speeds wayyy faster


magicmike123
HOBBYOP

9 months ago

ah no no its fine, this is fine i just wanna try fix issue


magicmike123
HOBBYOP

9 months ago

I get same error 😢


9 months ago

are you serious


magicmike123
HOBBYOP

9 months ago

yes, look:


9 months ago

can you confirm it says Dockerfile detected at the top of the build logs


9 months ago

and not anything about Railpack


magicmike123
HOBBYOP

9 months ago

1387502848069206300


magicmike123
HOBBYOP

9 months ago

I am using Railpack builder I think


magicmike123
HOBBYOP

9 months ago

like I changed long ago


magicmike123
HOBBYOP

9 months ago

idk the name


9 months ago

can you screenshot the root dir again


9 months ago

because if there is a dockerfile it should override that


magicmike123
HOBBYOP

9 months ago

1387502978407076000


9 months ago

Dockerfile


9 months ago

not DockerFile


magicmike123
HOBBYOP

9 months ago

1387503051685892400


9 months ago

All lowercase :)


magicmike123
HOBBYOP

9 months ago

ooh


magicmike123
HOBBYOP

9 months ago

all? dockerfile or Dockerfile?


9 months ago

sorry yeah Dockerfile


9 months ago

not all lowercase


magicmike123
HOBBYOP

9 months ago

1387503353377980400


magicmike123
HOBBYOP

9 months ago

what is this, git doesnt detect me deleting file


magicmike123
HOBBYOP

9 months ago

and creaitng again with correct case


magicmike123
HOBBYOP

9 months ago

okey i will commit with no file


magicmike123
HOBBYOP

9 months ago

first


magicmike123
HOBBYOP

9 months ago

2025 technology lol


magicmike123
HOBBYOP

9 months ago

okey pushing now


magicmike123
HOBBYOP

9 months ago

I got this error now, at least it changed idk


magicmike123
HOBBYOP

9 months ago

1387504119438119200


9 months ago

Bluh


9 months ago

Rename every instance of where I said binary with that


9 months ago

Control f


9 months ago

Leave instances of bin just replace the word binary


magicmike123
HOBBYOP

9 months ago

what I replace sorry I didnt understood


9 months ago

Anywhere you see the word binary


magicmike123
HOBBYOP

9 months ago

and what do I replace it with


9 months ago

Replace it with axumapibackend


magicmike123
HOBBYOP

9 months ago

ahh okey


9 months ago

I had thought it was generic but apparently not :)


magicmike123
HOBBYOP

9 months ago

1387506193827627000


9 months ago

😭


9 months ago

Can you show your cargo file


magicmike123
HOBBYOP

9 months ago

maybe I gotta use github repo name like axum gituhb repo name? idk https://github.com/GetGoofy/axumwithdb_demo


magicmike123
HOBBYOP

9 months ago

no idea


9 months ago

no no


magicmike123
HOBBYOP

9 months ago

hey look


magicmike123
HOBBYOP

9 months ago

i noticed this .toml file that I added at some point


magicmike123
HOBBYOP

9 months ago

1387506465555878000


magicmike123
HOBBYOP

9 months ago

I wonder if this is crashing the thing


magicmike123
HOBBYOP

9 months ago

and this my cargo.toml

1387506559168282600


9 months ago

Oh lol get rid of that


magicmike123
HOBBYOP

9 months ago

think It used to give an error and that fixed idk, I will just rename it so it doesnt work on railway


9 months ago

It won’t fix anything though


magicmike123
HOBBYOP

9 months ago

oh 😦


magicmike123
HOBBYOP

9 months ago

well im trying deploying now again


magicmike123
HOBBYOP

9 months ago

it crashes again


magicmike123
HOBBYOP

9 months ago

what can I do? I got no idea


magicmike123
HOBBYOP

9 months ago

I googled this and found this error from somebody else and apparently I need to install some postgres stuff but how am I going to do that in Railway? idk https://forum.freecodecamp.org/t/libpq-so-5-cannot-open-shared-object-file-no-such-file-or-directory/473096


magicmike123
HOBBYOP

9 months ago


magicmike123
HOBBYOP

9 months ago

but idk

1387507671829184500


magicmike123
HOBBYOP

9 months ago

what can do 😢


magicmike123
HOBBYOP

9 months ago

😢


magicmike123
HOBBYOP

9 months ago

chinchilla sad

1387509279908565000


magicmike123
HOBBYOP

9 months ago

somebody help me plz


9 months ago

Let me modify the Dockerfile with that research in mind


9 months ago

brb


9 months ago

FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
RUN cargo install cargo-chef
WORKDIR /app

FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder

COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .

RUN cargo build --release --bin axum_api_backend

FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates python3-psycopg2 libpq-dev && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/axum_api_backend /usr/local/bin/axum_api_backend

CMD ["/usr/local/bin/axum_api_backend"]

magicmike123
HOBBYOP

9 months ago

okey thanks ima try that one


magicmike123
HOBBYOP

9 months ago

seems it works now 🙂


magicmike123
HOBBYOP

9 months ago

so thank you a lot


magicmike123
HOBBYOP

9 months ago

but now i have this question: wtf do I even do when I find these crazy errors? just ask here and hope somebody knows, google, stack overflow? :S I guess idk


magicmike123
HOBBYOP

9 months ago

chinchilla happy 👍

1387516306202300700


9 months ago

What did here first is flip you to a system that I know works for me


9 months ago

I use that exact Dockerfile for all my deployments


9 months ago

Once I find that it doesn't work on what I know works, I branch out and look at specific issues


9 months ago

You did exactly what I would have done by googling it


9 months ago

Then I took that answer and applied it to the Dockerfile


9 months ago

And boom



magicmike123
HOBBYOP

9 months ago

i see thanks


Status changed to Solved chandrika 9 months ago


Loading...