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

Fix: dependencies compiled with incompatible versions of rustc #545

Merged
merged 9 commits into from
Dec 30, 2022
8 changes: 6 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ endif

BUILDX_FLAGS=$(BUILDX_OP) $(PLATFORM_FLAGS) $(CACHE_FLAGS)

# the rust version used by our containers, and as an override for our deployers
# ensuring all user crates are compiled with the same rustc toolchain
RUSTUP_TOOLCHAIN=1.65.0

TAG?=$(shell git describe --tags)
BACKEND_TAG?=$(TAG)
DEPLOYER_TAG?=$(TAG)
Expand Down Expand Up @@ -107,6 +111,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 \
Expand Down
2 changes: 1 addition & 1 deletion service/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ fn check_version(summary: &Summary) -> anyhow::Result<()> {
{
shuttle.version_req()
} else {
return Err(anyhow!("this crate does not use the shutte service"));
return Err(anyhow!("this crate does not use the shuttle service"));
};

if version_req.matches(&valid_version) {
Expand Down