Debian Codegraph @

tests/docker/Dockerfile.test

raw
1 ARG BASE_IMAGE=ubuntu:24.04
2
3 ### Test env phase
4 FROM ${BASE_IMAGE} AS test-setup
5 ARG BASE_IMAGE=ubuntu:24.04
6
7 ENV LC_ALL="C.UTF-8"
8 ENV GTEST_ROOT=/usr/local
9 ENV DEBIAN_FRONTEND=noninteractive
10
11 WORKDIR /saunafs
12 COPY ./tests/install-packages.sh ./tests/
13 COPY ./tests/llvm.sh ./tests/
14 RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
15 --mount=target=/var/cache/apt,type=cache,sharing=locked \
16 rm -f /etc/apt/apt.conf.d/docker-clean && \
17 apt-get update && apt-get install tini && \
18 ./tests/install-packages.sh;
19
20 COPY ./tests/ci_build/install-foundationdb.sh ./tests/ci_build/
21 COPY ./tests/setup_machine.sh ./tests/
22
23 # Run the setup-test-machine.sh script
24 RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
25 --mount=target=/var/cache/apt,type=cache,sharing=locked \
26 rm -f /etc/apt/apt.conf.d/docker-clean && \
27 ./tests/setup_machine.sh setup /mnt/hdd_0 /mnt/hdd_1 /mnt/hdd_2 /mnt/hdd_3 /mnt/hdd_4 /mnt/hdd_5 /mnt/hdd_6 /mnt/hdd_7 || true;
28
29 RUN mkdir -p /mnt/hdd_0/ /mnt/hdd_1/ /mnt/hdd_2/ /mnt/hdd_3/ /mnt/hdd_4/ /mnt/hdd_5/ /mnt/hdd_6/ /mnt/hdd_7/;
30 RUN chown saunafstest:saunafstest -R /mnt/hdd_*;
31
32 RUN if [ "$BASE_IMAGE" = "ubuntu:22.04" ]; then \
33 apt --yes update; \
34 apt --yes install -y gcc-12 g++-12; \
35 ln -s -f /usr/bin/gcc-12 /usr/bin/gcc; \
36 ln -s -f /usr/bin/g++-12 /usr/bin/g++; \
37 fi;
38
39 ### Build Phase
40 FROM test-setup AS test-build
41
42 # Enable additional basic tools
43 ENV PATH="/usr/lib/ccache:${PATH}"
44 ENV VCPKG_ROOT="/saunafs/vcpkg/"
45 ENV PATH="${VCPKG_ROOT}:${PATH}"
46
47 WORKDIR /saunafs
48 RUN mkdir -p .git/modules/vcpkg
49 COPY .git/modules/vcpkg .git/modules/vcpkg
50 COPY vcpkg/ vcpkg
51 COPY vcpkg.json .
52 RUN vcpkg/bootstrap-vcpkg.sh;
53 RUN --mount=type=cache,target=/saunafs/vcpkg/downloads/,sharing=locked --mount=type=cache,target=/saunafs/vcpkg/packages/,sharing=locked vcpkg/vcpkg install;
54
55 COPY CMakeLists.txt .
56 COPY cmake ./cmake
57 COPY config.h.in .
58 COPY external ./external
59 COPY utils ./utils
60 COPY src ./src
61 COPY doc ./doc
62 COPY tests ./tests
63 COPY COPYING .
64 COPY README.md .
65
66 RUN mkdir -p /saunafs/build && ls /saunafs && \
67 cd /saunafs/build && cmake \
68 -DCMAKE_TOOLCHAIN_FILE="/saunafs/vcpkg/scripts/buildsystems/vcpkg.cmake" \
69 -DENABLE_TESTS=1 \
70 -DENABLE_DOCS=1 \
71 -DENABLE_NFS_GANESHA=1 \
72 -DENABLE_CLIENT_LIB=ON \
73 -DENABLE_URAFT=ON \
74 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
75 -DENABLE_FOUNDATIONDB=ON \
76 ..;
77
78 # TODO: Use CMake presets
79 RUN --mount=type=cache,target=/root/.ccache \
80 cd /saunafs/build && make -j$(nproc) install;
81
82
83 WORKDIR /
84 ENV TERM=xterm
85 ENTRYPOINT ["tini", "--"]