-
Notifications
You must be signed in to change notification settings - Fork 422
Add dockerfile for cross itself #667
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
Conversation
docker/Dockerfile.cross
Outdated
|
||
ENV CROSS_DOCKER_IN_DOCKER=true | ||
|
||
RUN wget -O- https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz | tar -C /usr/bin/ --strip-components=1 -xzf - docker/docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check signature or checksum here so we don't rely on the file being unmodified in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not rare for tarball files to change behind the scene, so ensuring it is valid is a good security matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a Docker image we can copy the binary from instead using a multi-stage build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a docker in docker image but it has some other binaries which are not necessary and rust has to be installed manually which takes more steps than this multi-stage build.
The docker in docker image receives it binaries from download.docker.com
(layer 6) just like here, so there is no big difference when using the docker in docker image (besides the unwanted binaries which it has).
The checksum check is now implemented (md5) and it only checks the |
docker/Dockerfile.cross
Outdated
RUN wget -O- https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz | tar -C /usr/bin/ --strip-components=1 -xzf - docker/docker | ||
RUN echo $checksum | md5sum -c | ||
|
||
RUN cargo install cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should install the current version in this repository.
docker/Dockerfile.cross
Outdated
@@ -7,4 +7,4 @@ ARG checksum="d9d9b964d428733e98c2579b91772af4 /usr/bin/docker" | |||
RUN wget -O- https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz | tar -C /usr/bin/ --strip-components=1 -xzf - docker/docker | |||
RUN echo $checksum | md5sum -c | |||
|
|||
RUN cargo install cross | |||
RUN cargo install --git https://github.com/cross-rs/cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still wrong imo, I'd expect this to be built in our CI and published as ghcr.io/cross-rs/cross-in-docker
(or similar).
it should also if anything use --locked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this needs to be something like
COPY . .
RUN cargo install --path . --locked
@bytedream could you rebase and add a changelog entry? So we could trigger CI and see if it'll succeed. |
RUN wget -O- https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz | tar -C /usr/bin/ --strip-components=1 -xzf - docker/docker | ||
RUN echo $checksum | md5sum -c | ||
|
||
RUN cargo install --git https://github.com/cross-rs/cross |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still wrong, it should copy from the checked out code, if this is kept the CI will work, but it'll check the most recent main branch changes, not the proposed changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it should use the checkout for building, thanks @Emilgardis for raising this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image needs to be added
@@ -170,6 +170,8 @@ jobs: | |||
- { target: thumbv7em-none-eabi, os: ubuntu-latest, std: 1 } | |||
- { target: thumbv7em-none-eabihf, os: ubuntu-latest, std: 1 } | |||
- { target: thumbv7m-none-eabi, os: ubuntu-latest, std: 1 } | |||
|
|||
- { target: cross os: ubuntu-latest } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work either sadly, it'll have to be it's own task/action for the image to be built and published
This uses the official Docker docker-in-docker image for the latest stable, and installs the latest stable Rust version internally. It uses an entrypoint to ensure cargo is on the path, and that cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the official Docker docker-in-docker image for the latest stable, and installs the latest stable Rust version internally. It uses an entrypoint to ensure cargo is on the path, and that cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the official Docker docker-in-docker image for the latest stable, and installs the latest stable Rust version internally. It uses an entrypoint to ensure cargo is on the path, and that cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
This uses the installs Docker from the official sources using the latest Ubuntu image stable, and installs the latest stable Rust version internally. Cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Replaces cross-rs#667.
878: Add dockerfile for cross. r=Emilgardis a=Alexhuszagh This uses the official Docker docker-in-docker image for the latest stable, and installs the latest stable Rust version internally. It uses an entrypoint to ensure cargo is on the path, and that cross is installed from the latest git (locked), which when tagged will work well with our releases. It exports the environment variable `CROSS_CONTAINER_IN_CONTAINER` so everything should work as expected. Closes #468. Replaces #667. Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
Closed since #878 as merged. |
This adds a dockerfile which has cross and docker already installed and can be directly used to cross compile and test. It mostly adopts a comment in #260.
It uses docker in docker (#387) so to work correctly it must be run with the docker socket mounted as volume.
Although the README already describes how to achieve this, a provided Dockerfile that can be downloaded from Docker Hub in the best case would be much easier than writing your own. Especially when using a CI pipeline inside Docker, where creating a custom Dockerfile is not that easy, this could be a big help.
The directory of the Dockerfile may not be the best choice since only compile targets are in this directory but it was the best fit.