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

Add dockerfile for cross itself #667

Closed
wants to merge 7 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docker/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM rust:latest

ENV CROSS_DOCKER_IN_DOCKER=true

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
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Author

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).

RUN echo $checksum | md5sum -c

RUN cargo install --git https://github.com/cross-rs/cross
Copy link
Member

@Emilgardis Emilgardis Mar 20, 2022

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

Copy link
Member

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