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

Provide images with rustup / cargo installed #1516

Open
Emilgardis opened this issue Jun 21, 2024 · 6 comments
Open

Provide images with rustup / cargo installed #1516

Emilgardis opened this issue Jun 21, 2024 · 6 comments

Comments

@Emilgardis
Copy link
Member

We can, before

- name: Push image to GitHub Container Registry

also tag and publish an image which has rustup installed, this would help the use case of just wanting an image with cross-compilation tools + rust installed.

related to #1187

@randomairborne
Copy link

A significant problem with this might be the creation of an excessive number of new dockerfiles. Then again, maybe it could be done programatically somehow.

@randomairborne
Copy link

randomairborne commented Jun 22, 2024

How does:

FROM ghcr.io/cross-rs/{{TARGET}}:latest

ENV PATH="/root/.cargo/bin:$PATH"

RUN curl -fsSL https://sh.rustup.rs | bash -s -- -y --profile minimal
RUN rustup target add {{TARGET}}

look? This could probably be used to generate the required dockerfiles.

@Emilgardis
Copy link
Member Author

Emilgardis commented Jun 22, 2024

No, I don't see why we'd need to generate a bunch of dockerfiles. Instead we could just use a build-arg approach.

# Dockerfile.cross-with-cargo
ARG CROSS_IMAGE
ARG TARGET
FROM CROSS_IMAGE
ENV PATH="/root/.cargo/bin:$PATH"
RUN curl -fsSL https://sh.rustup.rs/ | bash -s -- -y --profile minimal
RUN rustup target add $TARGET

and then invoke it like docker buildx build -f Dockerfile.cross-with-cargo --build-arg CROSS_IMAGE="<image>" --build-arg TARGET="<target>"

hcl would probably be the best solution coupled with #849 however

@randomairborne
Copy link

That was what my comment originally was, and is what I'm currently using for cross-cargo. I just laser-focused on that for some reason LOL!
Is there already a list of supported targets that could be read from to generate the ARGs?

@Emilgardis
Copy link
Member Author

All targets built with ci lives in https://github.com/cross-rs/cross/blob/main/targets.toml, and if integrated in this repos CI the target name would already exist in ${{ matrix.target }}

@Emilgardis
Copy link
Member Author

Emilgardis commented Jun 22, 2024

or here also: https://github.com/cross-rs/cross/blob/main/src/docker/provided_images.rs

Oh, there's also a unmerged pr to make cross-util give the list: #1240

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

No branches or pull requests

2 participants