Skip to content

Commit

Permalink
chore: introduce cubejs/rust-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Jul 10, 2024
1 parent 4466e3a commit 9c7c2f2
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
26 changes: 1 addition & 25 deletions rust/cubestore/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
FROM rust:1-bookworm AS builder

RUN rustup update && \
rustup default nightly-2024-01-10 && \
rustup component add --toolchain nightly-2024-01-10 rustfmt;

RUN apt update \
&& apt upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common pkg-config wget gnupg git apt-transport-https ca-certificates \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
# https://github.com/llvm/llvm-project/issues/62475 \
# add it twice to workaround:
&& add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-18 main" \
&& add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-18 main" \
&& sleep 5 \
&& apt update \
&& apt install -y git llvm-18 clang-18 libclang-18-dev clang-18 cmake \
&& rm -rf /var/lib/apt/lists/*;

RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-18 100
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-18 100

WORKDIR /usr/src
FROM cubejs/rust-builder:bookworm-llvm-18 AS builder

WORKDIR /build/cubestore
COPY Cargo.toml .
Expand Down
29 changes: 29 additions & 0 deletions rust/cubestore/builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG OS_NAME=bookworm-slim

FROM rust:$OS_NAME

ARG LLVM_VERSION=18

RUN rustup update && \
rustup default nightly-2024-01-29 && \
rustup component add --toolchain nightly-2024-01-29 rustfmt clippy;

RUN apt update \
&& apt upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common libssl-dev pkg-config wget gnupg git apt-transport-https ca-certificates \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
# https://github.com/llvm/llvm-project/issues/62475 \
# add it twice to workaround:
&& add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \
&& add-apt-repository --yes "deb https://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" \
&& sleep 5 \
&& apt update \
&& apt install -y git llvm-$LLVM_VERSION clang-$LLVM_VERSION libclang-$LLVM_VERSION-dev clang-$LLVM_VERSION cmake \
&& rm -rf /var/lib/apt/lists/*;

RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION 100
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-$LLVM_VERSION 100
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-$LLVM_VERSION 100

WORKDIR /usr/src
10 changes: 10 additions & 0 deletions rust/cubestore/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target "rust-builder-bookworm" {
context = "."
dockerfile = "builder.Dockerfile"
args = {
OS_NAME = "1-slim-bookworm"
LLVM_VERSION = "18"
}
tags = ["cubejs/rust-builder:bookworm-llvm-18"]
platforms = ["linux/amd64", "linux/arm64"]
}
2 changes: 1 addition & 1 deletion rust/cubestore/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-01-29"
components = ["rustfmt", "rustc-dev", "clippy"]
components = ["rustfmt", "clippy"]
profile = "minimal"

0 comments on commit 9c7c2f2

Please sign in to comment.