~bigbes/tarantool

tarantool-protobuf

ref: 798e8db974f929988200e49ada81076b406a50bd tarantool-protobuf/docker/conformance.Dockerfile -rw-r--r-- 3.9 KiB
798e8db9 — Eugene Blikh json,text: presence-tracked fields skip proto3 default elision 3 months ago
                                                                                
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
# Builds a single image carrying `conformance_test_runner` (built from
# upstream protobuf source) and Tarantool. The repo is mounted as a volume
# at /work at runtime; we never copy sources into the image, so generated
# Lua from `make gen` on the host stays the source of truth.
#
# Build:  docker build -t tarantool-protobuf-conformance:latest \
#             -f docker/conformance.Dockerfile docker/
# Run:    just conformance         (see Justfile)

FROM ubuntu:24.04 AS builder

# Pinned to match the host protoc shipped by Homebrew (v34.1). Keeps the
# conformance corpus and our generated _pb.lua aligned with the same
# protobuf release that runs `make gen` on the host.
ARG PROTOBUF_TAG=v34.1

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates \
        cmake \
        ninja-build \
        build-essential \
        git \
        pkg-config \
    && rm -rf /var/lib/apt/lists/*

# Build protobuf via its own CMake project. -Dprotobuf_BUILD_CONFORMANCE
# adds the conformance/conformance_test_runner target. We rely on
# protobuf's vendored Abseil + utf8_range submodules to avoid mismatched
# system packages.
RUN git clone --depth 1 --branch ${PROTOBUF_TAG} --recurse-submodules \
        https://github.com/protocolbuffers/protobuf.git /src
WORKDIR /src
RUN cmake -GNinja -B build \
        -DCMAKE_BUILD_TYPE=Release \
        -Dprotobuf_BUILD_CONFORMANCE=ON \
        -Dprotobuf_BUILD_TESTS=OFF \
        -Dprotobuf_BUILD_EXAMPLES=OFF \
    && cmake --build build --target conformance_test_runner

# -----------------------------------------------------------------------------

FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive
# Use Tarantool's official installer to set up the apt repo. The script
# detects the distro, writes /etc/apt/sources.list.d/tarantool_*.list, and
# installs `tarantool` so we don't have to track URL/path schema changes
# ourselves.
RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
    && curl -L https://tarantool.io/release/3/installer.sh | bash \
    && apt-get install -y --no-install-recommends tarantool \
    && apt-get purge -y curl \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

COPY --from=builder /src/build/conformance_test_runner /usr/local/bin/conformance_test_runner
# protobuf's CMake build links conformance_test_runner against its
# vendored libjsoncpp as a shared library; the .so isn't installed and
# Ubuntu's libjsoncpp25 has a different soname. Ship the vendored copy.
# v34.1 fetches jsoncpp via CMake FetchContent; the vendored .so lives
# under _deps/jsoncpp-build/. Earlier protobuf releases placed it at
# /src/build/lib/. Pin to the v34.1 path since the Dockerfile is locked
# to that tag.
COPY --from=builder /src/build/_deps/jsoncpp-build/src/lib_json/libjsoncpp.so* /usr/local/lib/
RUN ldconfig

# All scripts expect to find generated modules + the runtime under /work.
WORKDIR /work
ENV LUA_PATH="./runtime/?/init.lua;./runtime/?.lua;./examples/expected/?.lua;./examples/expected/?/init.lua;./cmd/?.lua;./cmd/?/init.lua;;"
# Set PB_CONFORMANCE_SKIP_JSON=1 to short-circuit JSON output requests with
# `skipped` — useful when our JSON encoder hits a jsoncpp-crashing edge case
# and the suite would abort. Off by default now that the encoder no longer
# emits empty messages as `[]`.

# Default entrypoint exercises the Google suite against our runner.
# conformance_test_runner uses execv (not execvp), so the testee binary
# must be passed as an absolute path. Override via `docker run ... bash`
# for an interactive shell.
ENTRYPOINT ["/usr/local/bin/conformance_test_runner"]
CMD ["--enforce_recommended", \
     "--failure_list", "test/conformance/known_failures.txt", \
     "--text_format_failure_list", "test/conformance/known_failures_text.txt", \
     "/usr/bin/tarantool", "cmd/conformance-runner.lua"]