-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (53 loc) · 2.21 KB
/
Dockerfile
File metadata and controls
65 lines (53 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# ==============================================================================
# @file Dockerfile
# @brief Multi-stage containerized build environment for lzmalloc V2.
# @details Implements a reproducible compilation environment using Clang/LLVM.
# Separates the heavy build toolchain from the lightweight export artifact.
# ==============================================================================
# ------------------------------------------------------------------------------
# @stage 1: Builder
# @brief Installs the LLVM toolchain and compiles the memory allocator.
# ------------------------------------------------------------------------------
FROM ubuntu:24.04 AS builder
LABEL maintainer="frmlinn"
LABEL description="Compilation stage for lzmalloc 0.1.0"
ENV DEBIAN_FRONTEND=noninteractive
# Install core system dependencies, strict Clang toolchain, and competitor allocators
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
lld \
llvm \
cmake \
make \
libc6-dev \
git \
binutils \
valgrind \
gdb \
libjemalloc-dev \
libmimalloc-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /lzmalloc_src
# Copy project definition (Leveraging Docker Layer Caching)
COPY external/ external/
COPY include/ include/
COPY src/ src/
COPY tests/ tests/
COPY benchmarks/ benchmarks/
COPY CMakeLists.txt Makefile lz_config.h.in ./
# Execute the deterministic release build
RUN make release CC=clang
# Execute the debug build for the test suite target
RUN make debug CC=clang
# ------------------------------------------------------------------------------
# @stage 2: Artifact Exporter
# @brief Pristine runtime environment containing only the compiled shared object.
# ------------------------------------------------------------------------------
FROM ubuntu:24.04 AS runtime
# Copy the generated shared library from the builder stage
COPY --from=builder /lzmalloc_src/build/release/liblzmalloc.so /usr/local/lib/liblzmalloc.so
# Environment variables for seamless library injection
ENV LZMALLOC_SO="/usr/local/lib/liblzmalloc.so"
ENV LD_PRELOAD="/usr/local/lib/liblzmalloc.so"
# Default entrypoint drops the user into a bash shell with lzmalloc preloaded
CMD ["/bin/bash"]