Dockerfile 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. && cd ydb \
  20. && git init -b main \
  21. && git remote add origin $GIT_REPO \
  22. && git fetch --depth=1 origin $GIT_REF \
  23. && git reset --hard FETCH_HEAD
  24. COPY files/cmake_common.patch /tmp
  25. COPY files/make-vcs-info.py /tmp
  26. RUN cd ydb \
  27. && python3 /tmp/make-vcs-info.py . vcs-info.json \
  28. && cat vcs-info.json
  29. RUN cd ydb/ && patch -p1 < /tmp/cmake_common.patch
  30. RUN --mount=type=secret,id=ccache_remote_storage \
  31. mkdir build && cd build \
  32. && export CONAN_USER_HOME=/ydbwork/build \
  33. && export CCACHE_BASEDIR=/ydbwork/ \
  34. && export CCACHE_SLOPPINESS=locale \
  35. && export CCACHE_REMOTE_STORAGE="$( cat /run/secrets/ccache_remote_storage)" \
  36. && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
  37. -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache \
  38. -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain \
  39. ../ydb \
  40. && ninja ydb/apps/ydbd/ydbd ydb/apps/ydb/all \
  41. && ccache -s \
  42. && strip ydb/apps/ydbd/ydbd \
  43. && strip ydb/apps/ydb/ydb
  44. FROM ubuntu:22.04
  45. RUN apt-get update \
  46. && apt-get install --no-install-recommends -y libidn12 libaio1 \
  47. && rm -rf /var/lib/apt/lists/*
  48. RUN mkdir -p /root/ydb/bin/ \
  49. && mkdir -p /ydb_data \
  50. && mkdir -p ydb_certs \
  51. && echo '{"check_version":false}' > root/ydb/bin/config.json
  52. COPY --from=builder /ydbwork/build/ydb/apps/ydbd/ydbd /ydbwork/build/ydb/apps/ydb/ydb /
  53. COPY --from=yandex_local_build /local_ydb /
  54. COPY files/initialize_local_ydb.sh /initialize_local_ydb
  55. COPY files/health_check.sh /health_check
  56. COPY files/THIRD_PARTY_LICENSES /THIRD_PARTY_LICENSES
  57. COPY files/LICENSE /LICENSE
  58. RUN /ydbd -V
  59. RUN /ydb version
  60. # YDB grpc
  61. EXPOSE ${GRPC_TLS_PORT:-2135}
  62. EXPOSE ${GRPC_PORT:-2136}
  63. EXPOSE ${MON_PORT:-8765}
  64. HEALTHCHECK --start-period=60s --interval=1s CMD sh ./health_check
  65. CMD ["sh", "./initialize_local_ydb"]