Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # syntax=docker/dockerfile:1
  2. FROM cr.yandex/yc/yandex-docker-local-ydb@sha256:ce95513262a31fbe5b309521c362bde6d24ea68b7957bd874ef43d985a5d5e45 AS yandex_local_build
  3. FROM ubuntu:22.04 AS builder
  4. ARG DEBIAN_FRONTEND=noninteractive
  5. ENV TZ=Etc/UTC
  6. RUN apt-get update \
  7. && apt-get install -y sudo wget gnupg lsb-release curl xz-utils tzdata \
  8. cmake python3-pip ninja-build antlr3 m4 clang-12 lld-12 libidn11-dev libaio1 libaio-dev llvm-12 \
  9. && pip3 install conan==1.59 \
  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. RUN apt-get install -y --no-install-recommends git
  13. WORKDIR /ydbwork
  14. ARG GIT_REPO=https://github.com/ydb-platform/ydb.git
  15. ARG GIT_REF=main
  16. ENV GIT_REPO=$GIT_REPO
  17. ENV GIT_REF=$GIT_REF
  18. RUN mkdir ydb \
  19. && git clone --depth=1 -b "${GIT_REF?}" ${GIT_REPO?}
  20. RUN --mount=type=secret,id=ccache_remote_storage \
  21. mkdir build && cd build \
  22. && export CONAN_USER_HOME=/ydbwork/build \
  23. && export CCACHE_BASEDIR=/ydbwork/ \
  24. && export CCACHE_SLOPPINESS=locale \
  25. && export CCACHE_REMOTE_STORAGE="$(cat /run/secrets/ccache_remote_storage)" \
  26. && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  27. -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache \
  28. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  29. ../ydb \
  30. && ninja ydb/apps/ydbd/ydbd ydb/apps/ydb/all \
  31. && ccache -s \
  32. && strip ydb/apps/ydbd/ydbd \
  33. && strip ydb/apps/ydb/ydb
  34. FROM ubuntu:22.04
  35. RUN apt-get update \
  36. && apt-get install --no-install-recommends -y libidn12 libaio1 \
  37. && rm -rf /var/lib/apt/lists/*
  38. RUN mkdir -p /root/ydb/bin/ \
  39. && mkdir -p /ydb_data \
  40. && mkdir -p ydb_certs \
  41. && echo '{"check_version":false}' > root/ydb/bin/config.json
  42. COPY --from=builder /ydbwork/build/ydb/apps/ydbd/ydbd /ydbwork/build/ydb/apps/ydb/ydb /
  43. COPY --from=yandex_local_build /local_ydb /
  44. COPY files/initialize_local_ydb.sh /initialize_local_ydb
  45. COPY files/health_check.sh /health_check
  46. COPY files/THIRD_PARTY_LICENSES /THIRD_PARTY_LICENSES
  47. COPY files/LICENSE /LICENSE
  48. RUN /ydbd -V
  49. RUN /ydb version
  50. # YDB grpc
  51. EXPOSE ${GRPC_TLS_PORT:-2135}
  52. EXPOSE ${GRPC_PORT:-2136}
  53. EXPOSE ${MON_PORT:-8765}
  54. HEALTHCHECK --start-period=60s --interval=1s CMD sh ./health_check
  55. CMD ["sh", "./initialize_local_ydb"]