diff --git a/Containerfile b/Containerfile index b866f55b40..9c382250ae 100644 --- a/Containerfile +++ b/Containerfile @@ -1,5 +1,6 @@ #syntax=docker/dockerfile-upstream:1.4.0-rc1 -FROM rust:1.65.0-buster as shuttle-build +ARG RUSTUP_TOOLCHAIN +FROM rust:${RUSTUP_TOOLCHAIN}-buster as shuttle-build RUN apt-get update &&\ apt-get install -y curl # download protoc binary and unzip it in usr/bin @@ -26,7 +27,8 @@ COPY --from=cache /build . ARG folder RUN cargo build --bin shuttle-${folder} -FROM rust:1.65.0-buster as shuttle-common +ARG RUSTUP_TOOLCHAIN +FROM rust:${RUSTUP_TOOLCHAIN}-buster as shuttle-common RUN apt-get update &&\ apt-get install -y curl RUN rustup component add rust-src @@ -37,4 +39,6 @@ ARG folder COPY ${folder}/prepare.sh /prepare.sh RUN /prepare.sh COPY --from=builder /build/target/debug/shuttle-${folder} /usr/local/bin/service +ARG RUSTUP_TOOLCHAIN +ENV RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN} ENTRYPOINT ["/usr/local/bin/service"] diff --git a/Makefile b/Makefile index ee94af8f2c..bc8f0dec9b 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ endif BUILDX_FLAGS=$(BUILDX_OP) $(PLATFORM_FLAGS) $(CACHE_FLAGS) +# the rust version used by our containers +RUSTUP_TOOLCHAIN=1.65.0 + TAG?=$(shell git describe --tags) BACKEND_TAG?=$(TAG) DEPLOYER_TAG?=$(TAG) @@ -107,6 +110,7 @@ down: docker-compose.rendered.yml shuttle-%: ${SRC} Cargo.lock docker buildx build \ --build-arg folder=$(*) \ + --build-arg RUSTUP_TOOLCHAIN=$(RUSTUP_TOOLCHAIN) \ --tag $(CONTAINER_REGISTRY)/$(*):$(COMMIT_SHA) \ --tag $(CONTAINER_REGISTRY)/$(*):$(TAG) \ --tag $(CONTAINER_REGISTRY)/$(*):latest \ diff --git a/examples b/examples index 8ada303965..7797994292 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 8ada303965ff7ac14873358243bfa071ed11b7e8 +Subproject commit 7797994292dff8c8489e9b17e09780579d385e9a diff --git a/gateway/src/project.rs b/gateway/src/project.rs index 9f820f692c..c93b62882c 100644 --- a/gateway/src/project.rs +++ b/gateway/src/project.rs @@ -481,13 +481,8 @@ impl ProjectCreating { name: self.container_name(ctx), }; - // Get the version of rustc gateway was compiled with, matching the deployer - // RUSTUP_TOOLCHAIN override with the version from our Containerfile - let rustc_version = rustc_version_runtime::version().to_string(); - debug!( - "got installed rustc version for deployer toolchain override: {}", - rustc_version - ); + let rustup_toolchain = + std::env::var("RUSTUP_TOOLCHAIN").expect("rustup toolchain should be set"); let container_config = self .from @@ -525,7 +520,7 @@ impl ProjectCreating { "RUST_LOG=debug", // If we don't set this, users' dependencies with a `rust-toolchain.toml` // override will compile with incompatible versions of rust. - format!("RUSTUP_TOOLCHAIN={rustc_version}") + format!("RUSTUP_TOOLCHAIN={rustup_toolchain}") ] }) });