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

Support new-style Dockerfile #6

Open
2 tasks
lu-zero opened this issue Nov 9, 2023 · 0 comments
Open
2 tasks

Support new-style Dockerfile #6

lu-zero opened this issue Nov 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@lu-zero
Copy link
Collaborator

lu-zero commented Nov 9, 2023

Docker supports now multi-stage

  • 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 }}"]

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.

@Luni-4 Luni-4 added the enhancement New feature or request label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants