Skip to content

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

Open
@levi-nz

Description

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions