Dockerfile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # syntax=docker/dockerfile:1
  2. FROM ubuntu:22.04 AS builder
  3. ARG DEBIAN_FRONTEND=noninteractive
  4. ENV TZ=Etc/UTC
  5. RUN apt-get update \
  6. && apt-get install -y --no-install-recommends git wget gnupg lsb-release curl xz-utils tzdata \
  7. cmake python3-dev python3-pip ninja-build antlr3 m4 libidn11-dev libaio1 libaio-dev make \
  8. clang-12 lld-12 llvm-12 clang-14 lld-14 llvm-14 file \
  9. && pip3 install conan==1.59 grpcio-tools pyinstaller==5.13.2 six pyyaml packaging PyHamcrest cryptography \
  10. && (V=4.8.1; curl -L https://github.com/ccache/ccache/releases/download/v${V}/ccache-${V}-linux-x86_64.tar.xz | \
  11. tar -xJ -C /usr/local/bin/ --strip-components=1 --no-same-owner ccache-${V}-linux-x86_64/ccache)
  12. COPY ydb/ /ydbwork/ydb/
  13. WORKDIR /ydbwork/
  14. RUN --mount=type=secret,id=ccache_remote_storage \
  15. mkdir build && cd build \
  16. && export CONAN_USER_HOME=/ydbwork/build \
  17. && export CCACHE_BASEDIR=/ydbwork/ \
  18. && export CCACHE_SLOPPINESS=locale \
  19. && export CCACHE_REMOTE_STORAGE="$(cat /run/secrets/ccache_remote_storage)" \
  20. && export CC=/usr/bin/clang-14 \
  21. && export CC_FOR_BUILD=$CC \
  22. && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  23. -DCCACHE_PATH=/usr/local/bin/ccache \
  24. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  25. ../ydb \
  26. && ninja ydb/apps/ydbd/ydbd ydb/apps/ydb/all \
  27. && ccache -s \
  28. && strip ydb/apps/ydbd/ydbd \
  29. && strip ydb/apps/ydb/ydb \
  30. && mv ./ydb/apps/ydbd/ydbd / \
  31. && mv ./ydb/apps/ydb/ydb / \
  32. && /ydbd -V \
  33. && /ydb version \
  34. && cd .. && rm -rf build # for reduce cache size
  35. # always use local_ydb.spec from main revision
  36. COPY main/ydb/public/tools/local_ydb/local_ydb.spec ydb/ydb/public/tools/local_ydb/
  37. RUN cd ydb && \
  38. ./ydb/tests/oss/launch/compile_protos.sh . ydb library/cpp/actors && \
  39. cd ydb/public/tools/local_ydb/ && \
  40. pyinstaller local_ydb.spec && \
  41. ./dist/local_ydb --help
  42. FROM ubuntu:22.04
  43. RUN apt-get update \
  44. && apt-get install --no-install-recommends -y libidn12 libaio1 \
  45. && rm -rf /var/lib/apt/lists/*
  46. RUN mkdir -p /root/ydb/bin/ \
  47. && mkdir -p /ydb_data \
  48. && mkdir -p ydb_certs \
  49. && echo '{"check_version":false}' > root/ydb/bin/config.json
  50. COPY main/.github/docker/files/ /
  51. COPY --from=builder /ydbwork/ydb/ydb/public/tools/local_ydb/dist/local_ydb /
  52. COPY --from=builder /ydbd /ydb /
  53. # YDB grpc
  54. EXPOSE ${GRPC_TLS_PORT:-2135}
  55. EXPOSE ${GRPC_PORT:-2136}
  56. EXPOSE ${MON_PORT:-8765}
  57. HEALTHCHECK --start-period=60s --interval=1s CMD sh ./health_check
  58. CMD ["sh", "./initialize_local_ydb"]