Strange deploy error (Rust)
magicmike123
HOBBYOP

a year ago

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

Solved$10 Bounty

112 Replies

magicmike123
HOBBYOP

a year ago

N/A


a year ago

Oh god I remember this error


a year ago

It made me want to actually die inside


a year ago

Can you share your Dockerfile


magicmike123
HOBBYOP

a year ago

oh


magicmike123
HOBBYOP

a year ago

I am not using docker


a year ago

Sick


a year ago

Alright 1 sec


magicmike123
HOBBYOP

a year ago

1387501262844727356


a year ago

You're going to be


magicmike123
HOBBYOP

a year ago

no docker just normal thingy


magicmike123
HOBBYOP

a year ago

i mean normal cargo rust thingy


a year ago

yeah yeah


magicmike123
HOBBYOP

a year ago

going to get g00fed 😄


a year 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"]

a year ago

No file extension, just Dockerfile


a year ago

And throw that in it


magicmike123
HOBBYOP

a year ago

but im not using Docker in any part of the project


a year ago

Docker is not something you use in a project lol


a year ago

It is a build tool


magicmike123
HOBBYOP

a year ago

ah


a year ago

Railway is currently generating a dockerfile for you (sorta)


magicmike123
HOBBYOP

a year ago

ah so railway is using docker basically


a year ago

We're going to override it


magicmike123
HOBBYOP

a year ago

and i need to give instructions with this thing


magicmike123
HOBBYOP

a year ago

ah okey


magicmike123
HOBBYOP

a year ago

who is lukemathwalker


a year ago

Made cargo-chef


a year ago

Better caching


magicmike123
HOBBYOP

a year ago

ahh okey


a year ago

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


magicmike123
HOBBYOP

a year ago

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


magicmike123
HOBBYOP

a year ago

I get same error 😢


a year ago

are you serious


magicmike123
HOBBYOP

a year ago

yes, look:


a year ago

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


a year ago

and not anything about Railpack


magicmike123
HOBBYOP

a year ago

1387502848069206246


magicmike123
HOBBYOP

a year ago

I am using Railpack builder I think


magicmike123
HOBBYOP

a year ago

like I changed long ago


magicmike123
HOBBYOP

a year ago

idk the name


a year ago

can you screenshot the root dir again


a year ago

because if there is a dockerfile it should override that


magicmike123
HOBBYOP

a year ago

1387502978407076091


a year ago

Dockerfile


a year ago

not DockerFile


magicmike123
HOBBYOP

a year ago

1387503051685892237


a year ago

All lowercase :)


magicmike123
HOBBYOP

a year ago

ooh


magicmike123
HOBBYOP

a year ago

all? dockerfile or Dockerfile?


a year ago

sorry yeah Dockerfile


a year ago

not all lowercase


magicmike123
HOBBYOP

a year ago

1387503353377980468


magicmike123
HOBBYOP

a year ago

what is this, git doesnt detect me deleting file


magicmike123
HOBBYOP

a year ago

and creaitng again with correct case


magicmike123
HOBBYOP

a year ago

okey i will commit with no file


magicmike123
HOBBYOP

a year ago

first


magicmike123
HOBBYOP

a year ago

2025 technology lol


magicmike123
HOBBYOP

a year ago

okey pushing now


magicmike123
HOBBYOP

a year ago

I got this error now, at least it changed idk


magicmike123
HOBBYOP

a year ago

1387504119438119075


a year ago

Bluh


a year ago

Rename every instance of where I said binary with that


a year ago

Control f


a year ago

Leave instances of bin just replace the word binary


magicmike123
HOBBYOP

a year ago

what I replace sorry I didnt understood


a year ago

Anywhere you see the word binary


magicmike123
HOBBYOP

a year ago

and what do I replace it with


a year ago

Replace it with axum_api_backend


magicmike123
HOBBYOP

a year ago

ahh okey


a year ago

I had thought it was generic but apparently not :)


magicmike123
HOBBYOP

a year ago

1387506193827627048


a year ago

😭


a year ago

Can you show your cargo file


magicmike123
HOBBYOP

a year ago

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


magicmike123
HOBBYOP

a year ago

no idea


a year ago

no no


magicmike123
HOBBYOP

a year ago

hey look


magicmike123
HOBBYOP

a year ago

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


magicmike123
HOBBYOP

a year ago

1387506465555877900


magicmike123
HOBBYOP

a year ago

I wonder if this is crashing the thing


magicmike123
HOBBYOP

a year ago

and this my cargo.toml

1387506559168282725


a year ago

Oh lol get rid of that


magicmike123
HOBBYOP

a year ago

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


a year ago

It won’t fix anything though


magicmike123
HOBBYOP

a year ago

oh 😦


magicmike123
HOBBYOP

a year ago

well im trying deploying now again


magicmike123
HOBBYOP

a year ago

it crashes again


magicmike123
HOBBYOP

a year ago

what can I do? I got no idea


magicmike123
HOBBYOP

a year 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

a year ago


magicmike123
HOBBYOP

a year ago

but idk

1387507671829184603


magicmike123
HOBBYOP

a year ago

what can do 😢


magicmike123
HOBBYOP

a year ago

😢


magicmike123
HOBBYOP

a year ago

chinchilla sad

1387509279908565063


magicmike123
HOBBYOP

a year ago

somebody help me plz


a year ago

Let me modify the Dockerfile with that research in mind


a year ago

brb


a year 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

a year ago

okey thanks ima try that one


magicmike123
HOBBYOP

a year ago

seems it works now 🙂


magicmike123
HOBBYOP

a year ago

so thank you a lot


magicmike123
HOBBYOP

a year 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

a year ago

chinchilla happy 👍

1387516306202300556


a year ago

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


a year ago

I use that exact Dockerfile for all my deployments


a year ago

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


a year ago

You did exactly what I would have done by googling it


a year ago

Then I took that answer and applied it to the Dockerfile


a year ago

And boom



magicmike123
HOBBYOP

a year ago

i see thanks


Status changed to Solved chandrika 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...