You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a compilation stage that takes the image used by cross, copy the source codes, and then runs cargo build --release --target x86_64-unknown-linux-musl to compile the binary
Create the final image using the compilation artifacts produced in a second stage (as it is right now)
Example for amd-64:
FROM cross-image
COPY src/ Cargo.toml /
RUN cargo build --release --target x86_64-unknown-linux-musl
RUN mkdir -p x86_64-unknown-linux-musl
RUN cp target/x86_64-unknown-linux-musl/release/{{ name }} x86_64-unknown-linux-musl/
FROM amd64/alpine
ADD {{ name }} /
ENTRYPOINT ["/{{ name }}"]
Docker supports now multi-stage
cross
, copy the source codes, and then runscargo build --release --target x86_64-unknown-linux-musl
to compile the binaryExample for
amd-64
:This new approach should remove this part
Docker also supports multi-platform images.
The idea would be to remove the two
Dockerfiles
present in template, providing a single image that can run on more platforms.The text was updated successfully, but these errors were encountered: