Skip to content

Help with Rocket v0.5.0-rc.2 and Docker #2257

Discussion options

You must be logged in to vote

Solution from reddit user that worked.

The Rocket.toml file must be copied over to the final container with the binary.

Working Dockerfile

FROM rust:1.61 as builder
RUN USER=root

RUN mkdir rocket-docker-test
WORKDIR /rocket-docker-test
ADD . ./
RUN cargo clean && cargo build --release

FROM debian:bullseye
ARG APP=/user/src/app
RUN mkdir -p {$APP}

# Copy the compiled binaries into the new container.
COPY --from=builder /rocket-docker-test/target/release/rocket-docker-test ${APP}/rocket-docker-test
COPY --from=builder /rocket-docker-test/Rocket.toml ${APP}/Rocket.toml

WORKDIR ${APP}

EXPOSE 80

CMD ["./rocket-docker-test"]

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by physics515
Comment options

You must be logged in to vote
3 replies
@physics515
Comment options

@etsea117
Comment options

@physics515
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants