Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WORKDIR defaults to /volume -- is this desired? #116

Open
levi-nz opened this issue Jan 22, 2023 · 1 comment
Open

WORKDIR defaults to /volume -- is this desired? #116

levi-nz opened this issue Jan 22, 2023 · 1 comment

Comments

@levi-nz
Copy link

levi-nz commented Jan 22, 2023

I'm new to muslrust, and I'm having to use it to compile a binary for the x86_64-unknown-linux-musl target -- one thing I noticed, compared to other containers like rust, is that WORKDIR defaults to /volume. Take this Dockerfile for example:

FROM rust AS build
ADD src src
ADD Cargo.toml Cargo.toml
RUN cargo build --release

FROM public.ecr.aws/lambda/provided:al2
COPY --from=build ./target/release/collector-api main
RUN chmod o+rx main
ENTRYPOINT ["./main"]

This works, however when using muslrust instead of rust to build, I have to specify /volume in the COPY --from=build command:

FROM clux/muslrust:stable AS build
ADD src src
ADD Cargo.toml Cargo.toml
RUN cargo build --release --target x86_64-unknown-linux-musl

FROM public.ecr.aws/lambda/provided:al2
COPY --from=build ./volume/target/x86_64-unknown-linux-musl/release/collector-api ./app
RUN chmod o+rx ./app
ENTRYPOINT ["./app"]

This confused me for quite a while and I only found this out from looking at Docker command history for the container.

Is it intentional to have the working directory as /volume? If so, shouldn't this be documented somewhere like in the README?

@clux
Copy link
Owner

clux commented Jan 22, 2023

Yep, this is a good catch. Thank you.

Long story short; I wasn't actually aware that this could be done in an easier way without some explicit WORKDIR when this was conceived, and it's probably a bit too late to change it at this point (since nobody can reasonably expect to notice breaking changes in docker images between equal, floating tags), so this is probably one for README docs.

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

No branches or pull requests

2 participants