-
Notifications
You must be signed in to change notification settings - Fork 2
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
Install LLVM 17 by default, Automatically install correct Rust version as default t… #4
Open
EmilyMatt
wants to merge
12
commits into
main
Choose a base branch
from
llvm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0954da8
Move to LLVM, Automatically install correct Rust version as default t…
EmilyMatt 8cc1b14
add newlines, use AS instead of as, update actions
EmilyMatt 1ecca06
add python3-venv, set tag based on branch name
EmilyMatt 4a83dff
add docker
EmilyMatt 38768d6
Install docker as well, clean deb files afterwards
EmilyMatt d86b9ac
Ok it is needed :((
EmilyMatt c5bab57
use phusion, should be wayy smaller
EmilyMatt cb8609b
Set all other llvm tools we might need during builds etc
EmilyMatt e2db706
install pkgconf
EmilyMatt 66c6323
libc debug symbols
EmilyMatt 883af9d
Add set alternatives error handling
EmilyMatt be9225e
Reduce image size by 500MB or so
EmilyMatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,42 @@ | ||
FROM debian:bookworm-slim | ||
FROM debian:bookworm-slim AS base | ||
|
||
RUN apt-get update -y && apt-get install -y build-essential cmake m4 automake peg libtool autoconf python3 python3-pip git peg lcov openssl libssl-dev | ||
RUN apt update && apt install -y \ | ||
automake build-essential cmake curl git gnupg \ | ||
lcov libssl-dev libtool lsb-release m4 openssl \ | ||
peg python3 python3-pip python3-venv \ | ||
software-properties-common wget | ||
|
||
# install rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
# Add docker repo | ||
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs 2> /dev/null) stable" > /etc/apt/sources.list.d/docker.list | ||
RUN apt update && apt install -y containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-compose-plugin | ||
|
||
# add rust to path | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
RUN apt upgrade -y | ||
|
||
# Get LLVM, Clang | ||
ARG LLVM_VERSION=17 | ||
|
||
RUN wget https://apt.llvm.org/llvm.sh | ||
RUN chmod +x llvm.sh | ||
RUN ./llvm.sh ${LLVM_VERSION} all | ||
RUN rm llvm.sh | ||
|
||
COPY set_alternatives.sh . | ||
RUN ./set_alternatives.sh ${LLVM_VERSION} | ||
RUN rm set_alternatives.sh | ||
|
||
# install Rust using rustup, set toolchain to 1.77 as default until we upgrade to LLVM 18/19 | ||
ARG TOOLCHAIN_VERSION=1.77 | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${TOOLCHAIN_VERSION} | ||
|
||
# Clear cache before copying to scratch | ||
RUN apt autoremove -y && apt clean | ||
|
||
# Delete doc directory as it is unneeded and heavy | ||
RUN rm -r /usr/share/doc /root/.rustup/toolchains/1.77-$(uname -m)-unknown-linux-gnu/share/doc | ||
|
||
FROM scratch | ||
COPY --from=base / / | ||
|
||
# add rust to path for new image | ||
ENV PATH="/root/.cargo/bin:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
FROM ubuntu:22.04 as builder | ||
FROM ubuntu:jammy AS base | ||
|
||
RUN apt-get update -y && apt-get install -y curl build-essential cmake m4 automake peg libtool autoconf python3 python3-pip git peg lcov openssl libssl-dev | ||
RUN apt update -y && apt install -y \ | ||
automake build-essential cmake curl docker-buildx \ | ||
docker-compose-v2 git gnupg lcov libssl-dev libtool \ | ||
lsb-release m4 openssl peg python3 python3-pip \ | ||
python3-venv software-properties-common wget | ||
|
||
# install rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
RUN apt update -y && apt upgrade -y | ||
|
||
# add rust to path | ||
# Get LLVM, Clang | ||
ARG LLVM_VERSION=17 | ||
|
||
RUN wget https://apt.llvm.org/llvm.sh | ||
RUN chmod +x llvm.sh | ||
RUN ./llvm.sh ${LLVM_VERSION} all | ||
RUN rm llvm.sh | ||
|
||
COPY set_alternatives.sh . | ||
RUN ./set_alternatives.sh ${LLVM_VERSION} | ||
RUN rm set_alternatives.sh | ||
|
||
# install Rust using rustup, set toolchain to 1.77 as default until we upgrade to LLVM 18/19 | ||
ARG TOOLCHAIN_VERSION=1.77 | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${TOOLCHAIN_VERSION} | ||
|
||
# Clear cache before copying to scratch | ||
RUN apt autoremove -y && apt clean | ||
|
||
# Delete doc directory as it is unneeded and heavy | ||
RUN rm -r /usr/share/doc /root/.rustup/toolchains/1.77-$(uname -m)-unknown-linux-gnu/share/doc | ||
|
||
FROM scratch | ||
COPY --from=base / / | ||
|
||
# add rust to path for new image | ||
ENV PATH="/root/.cargo/bin:${PATH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /bin/bash | ||
|
||
LLVM_VERSION=$1 | ||
|
||
update-alternatives --install /usr/bin/clang clang "/usr/bin/clang-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/clang++ clang++ "/usr/bin/clang++-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/clang-format clang-format "/usr/bin/clang-format-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/clang-tidy clang-tidy "/usr/bin/clang-tidy-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/clangd clangd "/usr/bin/clangd-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/ld ld "/usr/bin/lld-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/lldb lldb "/usr/bin/lldb-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/llvm-config llvm-config "/usr/bin/llvm-config-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/llvm-cov llvm-cov "/usr/bin/llvm-cov-${LLVM_VERSION}" 100 | ||
update-alternatives --install /usr/bin/llvm-profdata llvm-profdata "/usr/bin/llvm-profdata-${LLVM_VERSION}" 100 | ||
|
||
# Rust needs this to find libclang when using the cc crate | ||
ln -sf "/usr/lib/$(gcc -dumpmachine)/libclang-${LLVM_VERSION}.so.1" /usr/lib/"$(gcc -dumpmachine)"/libclang.so |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimize package installation commands.
Including
apt upgrade
can lead to larger image sizes and potential issues during upgrades. Consider removing it or handling upgrades more carefully.- RUN apt upgrade -y
Committable suggestion