-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (51 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (51 loc) · 1.46 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
66
# Multi-stage Dockerfile for Boid Simulation
# Supports build, test, and headless experiment modes
FROM ubuntu:24.04 AS base
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
clang \
libc++-dev \
libc++abi-dev \
libglew-dev \
libglfw3-dev \
libgtest-dev \
libyaml-cpp-dev \
libomp-dev \
llvm \
cmake \
make \
&& rm -rf /var/lib/apt/lists/*
# Build and install Google Test (Ubuntu provides sources, not binaries)
RUN cd /usr/src/googletest && \
cmake -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_INSTALL_PREFIX=/usr/local . && \
make -j$(nproc) && \
make install && \
ldconfig
WORKDIR /app
# ============ Builder stage ============
FROM base AS builder
# Copy source files
COPY src/ src/
COPY tests/ tests/
COPY config/ config/
COPY makefile.docker makefile
# Build all targets
RUN make all && make test_runner && make experiment
# ============ Test stage ============
FROM builder AS test
# Run tests by default
CMD ["./test_runner"]
# ============ Coverage stage ============
FROM builder AS coverage
RUN make coverage
CMD ["cat", "build/coverage/html/index.html"]
# ============ Experiment stage ============
FROM builder AS experiment
# Copy output directory for results
VOLUME ["/app/output"]
ENTRYPOINT ["./experiment"]
CMD ["config/default.yaml", "output/results.csv"]