Skip to content

Conversation

@sfalvo-aerospike
Copy link
Contributor

This Dockerfile builds a Debian Trixie base image with the latest Rust installed. It then executes a Bash script named "startup-sequence", whose job it is to run the cargo test command to invoke tests. Note that some environment variables are required when running the resulting Docker image (see Rust client docs).

As more property-based testing facilities are provided, this Dockerfile and startup-sequence may be amended to take additional configuration via environment variables.

This Dockerfile builds a Debian Trixie base image with the latest Rust
installed.  It then executes a Bash script named "startup-sequence",
whose job it is to run the `cargo test` command to invoke tests.  Note
that some environment variables are required when running the resulting
Docker image (see Rust client docs).

As more property-based testing facilities are provided, this Dockerfile
and startup-sequence may be amended to take additional configuration via
environment variables.
Copy link

@juliannguyen4 juliannguyen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is fine since we need to get the rests running ASAP. Just something to note in the future:

  • We should add a README explaining what the Dockerfile is used for
  • Also you can chmod u+x the startup script and commit those permissions in the repo
  • There's an official image for Rust: https://hub.docker.com/_/rust
  • To test the Dockerfile, you can use it to run the tests in CI/CD

v2 is an older branch than tls; tls is where all mainline development is
being staged for MNTN.

COPY startup-sequence /app/startup-sequence
RUN chmod +x /app/startup-sequence
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already sourced in the script, why add it here?


git clone https://github.com/aerospike/aerospike-client-rust.git
cd aerospike-client-rust
git checkout tls
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the name of the branch should be an ENV variable.

cd aerospike-client-rust
git checkout tls
cargo clean
cargo fix --lib -p aerospike-core
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed. Fixes should be applied to the source, otherwise tests will run on different source code.

git checkout tls
cargo clean
cargo fix --lib -p aerospike-core
cargo test
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do the ENV variables come from? IIRC they need to be explicitly passed here, no?

@juliannguyen4
Copy link

Also noticed that Rust client code seems to be building when running the container. Shouldn't this already be built in the image?

@sfalvo-aerospike
Copy link
Contributor Author

Also noticed that Rust client code seems to be building when running the container. Shouldn't this already be built in the image?

This is what I was talking about yesterday regarding the cargo test --no-run flag. However, I wasn't able to get it working in the Dockerfile. So, rather than commit a broken Dockerfile, I did the "worse-is-better" thing and just let Cargo build the tests before running them. We can always iterate and improve upon this later.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants