-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
62 lines (44 loc) · 1.52 KB
/
Dockerfile
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
ARG CC=clang
FROM ubuntu:22.04 AS base
RUN apt update && apt install -y cmake git ninja-build software-properties-common
FROM base AS base-clang
RUN apt update && apt install -y gpg lsb-release wget
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 17
ENV CC=clang-17
ENV CXX=clang++-17
FROM base AS base-gcc
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt update && apt install -y g++-13
ENV CC=gcc-13
ENV CXX=g++-13
FROM base-$CC AS deps
WORKDIR /project/src
COPY CMakeLists.txt /project/src
WORKDIR /project/build
RUN cmake ../src -GNinja -DDEPS_ONLY=TRUE
RUN cmake --build .
FROM deps AS build
COPY src /project/src/src
RUN cmake ../src -GNinja -DDEPS_ONLY=FALSE
RUN cmake --build .
CMD ./cpploxbc
FROM build AS test
RUN apt update && apt install -y clang-format cppcheck valgrind
COPY .clang-format /project/src
COPY test /project/src/test
RUN cmake ../src -GNinja -DDEPS_ONLY=FALSE -DENABLE_TESTING=TRUE
RUN cmake --build .
RUN ctest --verbose --output-on-failure
FROM test as bench
RUN apt update && apt install -y nodejs default-jdk
WORKDIR /project/build/_deps/crafting_interpreters-src
RUN make jlox clox
WORKDIR /project/build
RUN ./bench_test
FROM bench as debug
RUN apt update && apt install -y gdb vim
RUN cmake ../src -GNinja -DDEPS_ONLY=FALSE -DENABLE_TESTING=TRUE -DCMAKE_BUILD_TYPE=Debug
RUN cmake --build .
RUN ctest --verbose --output-on-failure