java - 在 openjdk docker 镜像上安装 Rust

标签 java docker selenium testing rust

我正在尝试编写一个 dockerfile 来运行一个 Rust 测试套件,该套件需要一个 jar 在单独的端口上运行。我已将 jar 下载到项目中,并希望从 openjdk docker 镜像开始并下载 rust。这样我就可以使用 java 命令运行 jar,然后使用 Cargo 来运行测试。

# Start with java
FROM openjdk:latest

# Add rust
RUN <one line command to download rust>

# Install production dependencies and build a release artifact.
RUN cargo build --release

# Start chromedriver, geckodriver, and selenium standalone binary
RUN ./thirtyfour/tests/binaries_and_jars/chromedriver
RUN ./thirtyfour/tests/binaries_and_jars/geckodriver
RUN java -jar ./thirtyfour/tests/binaries_and_jars/selenium.jar standalone --port 1234

# Run the tests
RUN cargo test

我希望使用网站上提供的curl命令下载rust,将所有选项作为cli参数传递,但我仍然收到提示。运行

curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable --default-host x86_64-unknown-linux-gnu --profile default

仍然会产生确认提示。

我愿意接受这里的任何解决方案,包括

  1. 安装 Rust 的一行命令
  2. 从 rust 镜像开始 + 一行命令来安装 java。

最佳答案

您可以通过添加 -y 参数来跳过确认提示。这可以在安装程序脚本的帮助页面中找到。

The installer for rustup

USAGE:
    rustup-init [FLAGS] [OPTIONS]

FLAGS:
    -v, --verbose           Enable verbose output
    -q, --quiet             Disable progress output
    -y                      Disable confirmation prompt.
        --no-modify-path    Don't configure the PATH environment variable
    -h, --help              Prints help information
    -V, --version           Prints version information

OPTIONS:
        --default-host <default-host>              Choose a default host triple
        --default-toolchain <default-toolchain>    Choose a default toolchain to install
        --default-toolchain none                   Do not install any toolchains
        --profile [minimal|default|complete]       Choose a profile
    -c, --component <components>...                Component name to also install
    -t, --target <targets>...                      Target name to also install

关于java - 在 openjdk docker 镜像上安装 Rust,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74174766/

相关文章:

Docker 在 OS/X 上推送非常慢 - 并且似乎推送已经推送的层

linux - 重新启动终端并使用 Dockerfile 运行命令

java - Selenium Cucumber 功能文件在 Eclipse 中未启用

java - 共享 EntityManager 上下文中使用的事务的范围是什么?

azure - 无法访问在Azure中使用DCOS Marathon部署的helloworld应用程序

java - 在 Linux 上运行时如何为 Chrome 驱动程序设置自定义 TMPDIR?

javascript - 如何在Selenium JS中获取子节点的数量

java - ubuntu上的运行时执行

java - 错误 "Expression expected",我缺少什么表达式?

java - 内存不足错误 : Java Heap Space - PreparedStatement MySQL