Skip to content

Commit

Permalink
Merge branch 'main' into logger-json
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelsaabna authored Dec 11, 2024
2 parents c60d8d2 + c23e372 commit c95bf65
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/containerbase/devcontainer:13.2.3
FROM ghcr.io/containerbase/devcontainer:13.2.5
11 changes: 10 additions & 1 deletion src/usr/local/containerbase/tools/v2/rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ function init_tool () {
chown -R "${USER_ID}" "${cargo_home}"
}

function check_tool_requirements () {
if [[ "${TOOL_VERSION}" == "nightly" || "${TOOL_VERSION}" == "beta" ]]; then
# allow beta and nightly versions
return
fi
# Sensitive default that can be overwritten by tools if needed
check_semver "$TOOL_VERSION" "all"
}

function install_tool () {
local versioned_tool_path
local file
Expand Down Expand Up @@ -55,7 +64,7 @@ function install_tool () {
mkdir -p "${TEMP_DIR}/rust"
bsdtar --strip 1 -C "${TEMP_DIR}/rust" -xf "${file}"
versioned_tool_path=$(create_versioned_tool_path)
"${TEMP_DIR}/rust/install.sh" --prefix="$versioned_tool_path" --components=cargo,rust-std-"${arch}"-unknown-linux-gnu,rustc
"${TEMP_DIR}/rust/install.sh" --prefix="$versioned_tool_path" --components="cargo,rust-std-${arch}-unknown-linux-gnu,rustc"
rm -rf "${TEMP_DIR}/rust"
}

Expand Down
28 changes: 28 additions & 0 deletions test/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,38 @@ RUN set -ex; \
ls -la /tmp/containerbase/cache; \
true

#--------------------------------------
# test c: beta
#--------------------------------------
FROM base AS testc

USER 12021

RUN install-tool rust beta

SHELL [ "/bin/sh", "-c" ]
RUN rustc --version
RUN cargo --version

#--------------------------------------
# test d: nightly
#--------------------------------------
FROM base AS testd

USER 12021

RUN install-tool rust nightly

SHELL [ "/bin/sh", "-c" ]
RUN rustc --version
RUN cargo --version

#--------------------------------------
# final
#--------------------------------------
FROM base

COPY --from=testa /.dummy /.dummy
COPY --from=testb /.dummy /.dummy
COPY --from=testc /.dummy /.dummy
COPY --from=testd /.dummy /.dummy

0 comments on commit c95bf65

Please sign in to comment.