dockerized app just outputs Hello, world! and exits. #2517
-
I have a more or less simple template and simple
I am so confused. I read all relatable issues and discussions I could find. I don't get where the hell this hello world could be, it is definitely not in my project. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Here's a FROM docker.io/rust:1.68.2-slim-bullseye AS builder
WORKDIR /build
COPY . .
RUN --mount=type=cache,target=/build/target \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/usr/local/rustup \
set -eux; \
rustup install stable; \
cargo build --release; \
objcopy --compress-debug-sections target/release/server ./server
################################################################################
FROM docker.io/debian:bullseye-slim
WORKDIR /app
COPY --from=builder /build/server ./server
CMD ROCKET_ADDRESS=0.0.0.0 ROCKET_PORT=$PORT ./server Build and run: docker build -t server:local .
docker run -e=PORT=8000 -dt -p 8000:8000/tcp --rm server:local Can you give this a try and see if there's an issue? |
Beta Was this translation helpful? Give feedback.
Here's a
Dockerfile
that I recommend using as a template: