Skip to content

Commit

Permalink
Build re_dms against Ubuntu Bionic
Browse files Browse the repository at this point in the history
As of Dec, 2021, we run re_dms on Ubuntu 18.04 which has glibc 2.27. However, Rust official docker images are based on directly on Debian. Ubuntu 18.04 is based on Debian Buster, however Buster runs glibc 2.28. Hence, building our executable against a Buster Debian image breaks because it expects glibc 2.28 at runtime (and it's not there). We've essentially created our own Rust docker image against Ubuntu 18.04 in order to build our executable guaranteed to be compatible with our deploy target.

A breakdown of Debian/Ubuntu glibc deps can be found here: rigetti/docker-lisp#3 (comment)
  • Loading branch information
joshuafleck committed Dec 21, 2021
1 parent a6e47e3 commit c407b1a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
FROM rustlang/rust:nightly-buster as builder
# > Start > Borrowed from: https://github.com/rust-lang/docker-rust-nightly/blob/2896708e58424ce0495c83f0364106e4f93b31bf/buster/Dockerfile
# As of Dec, 2021, we run re_dms on Ubuntu 18.04 which has glibc 2.27. However, Rust official docker images are based on directly on Debian. Ubuntu 18.04 is based
# on Debian Buster, however Buster runs glibc 2.28. Hence, building our executable against a Buster Debian image breaks because it expects glibc 2.28 at
# runtime (and it's not there). We've essentially created our own Rust docker image against Ubuntu 18.04 in order to build our executable guaranteed to be compatible with our deploy target.
FROM buildpack-deps:bionic

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
\
url="https://static.rust-lang.org/rustup/dist/${rustArch}/rustup-init"; \
wget "$url"; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain nightly; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
# > end

# Two step build: one to build dependences, one to build the re_dms app, which allows for faster docker builds once the dependencies layer has been built (it will rarely change)
# app
Expand Down

0 comments on commit c407b1a

Please sign in to comment.