Skip to content

Commit

Permalink
Merge pull request #16 from trailofbits/mschwager-version-args
Browse files Browse the repository at this point in the history
Support RUBY_VERSION and LLVM_VERSION build args when building Docker dev image
  • Loading branch information
mschwager authored Mar 28, 2024
2 parents 2702534 + c9bfcd0 commit e8f4709
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `Ruzzy.c_trace_branch` to `Ruzzy.trace` to simplify interface
- Support for `clang` back to `14.0.6`, and system `clang`, e.g. from `apt` ([#12](https://github.com/trailofbits/ruzzy/pull/12))
- Support `RUBY_VERSION` and `LLVM_VERSION` build args when building Docker development image

### Fixed

Expand Down
31 changes: 23 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
FROM debian:12-slim
# https://hub.docker.com/_/ruby
ARG RUBY_VERSION=3.3

FROM ruby:$RUBY_VERSION-slim-bookworm

RUN apt update && apt install -y \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*

# LLVM builds version 15-18 for Debian 12 (Bookworm)
# https://apt.llvm.org/bookworm/dists/
ARG LLVM_VERSION=18

RUN echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" > /etc/apt/sources.list.d/llvm.list
RUN echo "deb-src http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-$LLVM_VERSION main" >> /etc/apt/sources.list.d/llvm.list
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key > /etc/apt/trusted.gpg.d/apt.llvm.org.asc

RUN apt update && apt install -y \
build-essential \
clang \
ruby \
ruby-dev \
clang-$LLVM_VERSION \
&& rm -rf /var/lib/apt/lists/*

ENV APP_DIR="/app"
RUN mkdir $APP_DIR
WORKDIR $APP_DIR

ENV CC="clang"
ENV CXX="clang++"
ENV LDSHARED="clang -shared"
ENV LDSHAREDXX="clang++ -shared"
ENV CC="clang-$LLVM_VERSION"
ENV CXX="clang++-$LLVM_VERSION"
ENV LDSHARED="clang-$LLVM_VERSION -shared"
ENV LDSHAREDXX="clang++-$LLVM_VERSION -shared"
ENV ASAN_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-$LLVM_VERSION"

# The MAKE variable allows overwriting the make command at runtime. This forces the
# Ruby C extension to respect ENV variables when compiling, like CC, CFLAGS, etc.
Expand Down

0 comments on commit e8f4709

Please sign in to comment.