2 years ago
My Docker image is working as expected locally, but it seems to be stuck on an older version on Railway. The build logs look fine, but when publishing the image there are a bunch of layer already exists errors.
My project id is: b74571d8-e862-4ac2-ad76-e19a69371a8e
50 Replies
2 years ago
Railway does layer caching if nothing in that layer has changed.
2 years ago
does this mean you are deploying with a Dockerfile?
2 years ago
please share the dockerfile
FROM rust:latest as builder
RUN cargo new --bin app
WORKDIR /app
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN cargo build --release
RUN rm src/*.rs
COPY ./src ./src
COPY ./migrations ./migrations
COPY ./diesel.toml ./diesel.toml
RUN cargo build --release
FROM rust:latest
RUN apt-get update && apt-get install --yes libsqlite3-dev
ENV PORT=3000
EXPOSE ${PORT}
WORKDIR /app
COPY --from=builder /app/target/release/make_an_api_in_rust /app/make_an_api_in_rust
CMD ["/app/make_an_api_in_rust"]2 years ago
I might not be a rust dev by why is cargo build being ran twice?
The first time to install the dependencies, and the second one to build the application itself.
2 years ago
okay, odd given they are the exact same commands, rust sure loves ambiguity.
but what makes you think railway is not running the latest code?
Because it's printing hello world to the deploy logs and the http service is not running
2 years ago
if thats the case, set a variable NO_CACHE=1
2 years ago
show me how you are setting it
2 years ago
can you push an empty commit
2 years ago
and what makes you think the http server isnt starting?
Also it's weird that hello world its printed because that not in the code
2 years ago
how are you sure you are pushing code that runs an http server?
2 years ago
i think it would be worth it
https://github.com/aloussase/rust-api-clean-architecture here's the code
2 years ago
show me the source of your service
here you can see the server is set to run and there is no hello world being printed
2 years ago
full build logs please
Here you go
2 years ago
change the name of the binary thats being built?
2 years ago
try deploying the repo into a new service
I think there is a problem with my Dockerfile, since I did a full rebuild now and it behaves same as railway
2 years ago
well I'm glad you came to that conclusion because you wouldn't have believed me if I told you it was an issue on your side
2 years ago
haha you gotta tell me what the issue was
I honestly don't know. I think Cargo was doing some weird things. I simplified the Dockerfile to issue a single cargo build --release command.
2 years ago
i knew that double command was fishy



