File: Dockerfile.test

package info (click to toggle)
saunafs 5.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,820 kB
  • sloc: cpp: 109,287; sh: 18,755; python: 4,737; ansic: 4,023; makefile: 60; awk: 17
file content (88 lines) | stat: -rw-r--r-- 2,598 bytes parent folder | download
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
ARG BASE_IMAGE=ubuntu:24.04

### Test env phase
FROM ${BASE_IMAGE} AS test-setup
ARG BASE_IMAGE=ubuntu:24.04

ENV LC_ALL="C.UTF-8"
ENV GTEST_ROOT=/usr/local
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /saunafs
COPY ./tests/install-packages.sh ./tests/
COPY ./tests/llvm.sh ./tests/
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
    --mount=target=/var/cache/apt,type=cache,sharing=locked \
    rm -f /etc/apt/apt.conf.d/docker-clean && \
	apt-get update && apt-get install tini && \
    ./tests/install-packages.sh;

COPY ./tests/ci_build/install-foundationdb.sh ./tests/ci_build/
COPY ./tests/setup_machine.sh ./tests/

# Run the setup-test-machine.sh script
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
    --mount=target=/var/cache/apt,type=cache,sharing=locked \
    rm -f /etc/apt/apt.conf.d/docker-clean && \
    ./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;

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/;
RUN chown saunafstest:saunafstest -R /mnt/hdd_*;

RUN if [ "$BASE_IMAGE" = "ubuntu:22.04" ]; then \
        apt --yes update; \
        apt --yes install -y gcc-12 g++-12;    \
        ln -s -f /usr/bin/gcc-12 /usr/bin/gcc; \
        ln -s -f /usr/bin/g++-12 /usr/bin/g++; \
fi;

### Build Phase
FROM test-setup AS test-build

# Enable additional basic tools
ENV PATH="/usr/lib/ccache:${PATH}"

WORKDIR /
RUN git clone https://github.com/microsoft/vcpkg.git /vcpkg;
WORKDIR /vcpkg
COPY vcpkg.json .
RUN git pull;
RUN ./bootstrap-vcpkg.sh;
RUN --mount=type=cache,target=/vcpkg/downloads/,sharing=locked --mount=type=cache,target=/vcpkg/packages/,sharing=locked ./vcpkg install;

ENV VCPKG_ROOT="/vcpkg/"
ENV PATH="${VCPKG_ROOT}:${PATH}"

WORKDIR /saunafs
COPY CMakeLists.txt .
COPY cmake ./cmake
COPY config.h.in .
COPY external ./external
COPY utils ./utils
COPY src ./src
COPY doc ./doc
COPY tests ./tests
COPY COPYING .
COPY README.md .
RUN cp /vcpkg/vcpkg.json .;

RUN mkdir -p /saunafs/build && ls /saunafs && \
    cd /saunafs/build && cmake \
	-DCMAKE_TOOLCHAIN_FILE="/vcpkg/scripts/buildsystems/vcpkg.cmake" \
    -DENABLE_TESTS=1 \
    -DENABLE_DOCS=1 \
    -DENABLE_NFS_GANESHA=1 \
    -DENABLE_CLIENT_LIB=ON \
    -DENABLE_URAFT=ON \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
    -DENABLE_FOUNDATIONDB=ON \
    ..;

# TODO: Use CMake presets
RUN --mount=type=cache,target=/root/.ccache \
    cd /saunafs/build && make -j$(nproc) install;


WORKDIR /
ENV TERM=xterm
ENTRYPOINT ["tini", "--"]