From 9c2d6fe20bf1499d3ee5bf82ce26b96905890f90 Mon Sep 17 00:00:00 2001 From: Alex Chi Date: Thu, 7 Apr 2022 15:21:19 +0800 Subject: [PATCH] docs: add readme for docker folder (#1649) Signed-off-by: Alex Chi --- CONTRIBUTING.md | 1 + Makefile | 5 +++- docker/README.md | 15 +++++++++++ docker/frontend-legacy/Dockerfile | 31 ++++++++++++++++++++++ docker/frontend-v2/Dockerfile | 36 -------------------------- docker/frontend/Dockerfile | 43 +++++++++++++++++-------------- 6 files changed, 75 insertions(+), 56 deletions(-) create mode 100644 docker/README.md create mode 100644 docker/frontend-legacy/Dockerfile delete mode 100644 docker/frontend-v2/Dockerfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d96565e56da1..aaef831be6aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,6 +69,7 @@ Then you'll be able to compile and start RisingWave! - The `legacy` folder contains RisingWave legacy frontend code. This is to be deprecated, and should not be used in production environment. - The `src` folder contains all of the kernal components, read [src/README.md][https://github.com/singularity-data/risingwave/blob/main/src/README.md] for more details. +- The `docker` folder contains Dockerfiles to build and start RisingWave. - The `e2e_test` folder contains the latest end-to-end test cases. - The `docs` folder contains user and developer docs. If you want to learn about RisingWave, it's a good place to go! - The `dashbaord` folder contains RisingWave dashboard v2. diff --git a/Makefile b/Makefile index fcfb33d56d2e..aa7029dff823 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,10 @@ export DOCKER_IMAGE_TAG ?= latest export DOCKER_COMPONENT_BACKEND_NAME ?= backend export DOCKER_COMPONENT_FRONTEND_NAME ?= frontend -docker: docker_frontend docker_backend +docker: docker_frontend docker_frontend_legacy docker_backend + +docker_frontend_legacy: + docker build -f docker/frontend-legacy/Dockerfile -t ${DOCKER_GROUP_NAME}/${DOCKER_COMPONENT_FRONTEND_NAME}:${DOCKER_IMAGE_TAG} . docker_frontend: docker build -f docker/frontend/Dockerfile -t ${DOCKER_GROUP_NAME}/${DOCKER_COMPONENT_FRONTEND_NAME}:${DOCKER_IMAGE_TAG} . diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000000..29fe78ee61ad --- /dev/null +++ b/docker/README.md @@ -0,0 +1,15 @@ +# Docker Images + +RisingWave currently *only supports Linux x86_64* for building docker images. + +To build the images, simply run: + +``` +make docker_frontend +make docker_backend +``` + +in the project root. + +For developers, we always recommend using risedev to start the full cluster, instead of using these docker images. +See [CONTRIBUTING](../CONTRIBUTING.md) for more information. diff --git a/docker/frontend-legacy/Dockerfile b/docker/frontend-legacy/Dockerfile new file mode 100644 index 000000000000..e48dc7e96b7d --- /dev/null +++ b/docker/frontend-legacy/Dockerfile @@ -0,0 +1,31 @@ +FROM openjdk:11.0.13-jdk-bullseye as risingwave_fe_builder + +ENV LANG en_US.utf8 +ENV RISINGWAVE_FE_HOME=/risingwave_fe +ENV RISINGWAVE_FE_BUILD_ENV=docker +ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 + +RUN mkdir -p $RISINGWAVE_FE_HOME/proto $RISINGWAVE_FE_HOME/legacy + +WORKDIR $RISINGWAVE_FE_HOME +COPY proto ./proto + +WORKDIR $RISINGWAVE_FE_HOME/legacy +COPY legacy ./ + +RUN ./gradlew build + +FROM openjdk:11.0.13-jre-slim-bullseye + +RUN mkdir dir -p /risingwave_fe/conf /risingwave_fe/lib + +COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/libs/risingwave-fe-runnable.jar /risingwave_fe/lib +COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/resources/main/server.properties /risingwave_fe/conf +COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/resources/main/logback.xml /risingwave_fe/conf + +WORKDIR /risingwave_fe + +ENV RISINGWAVE_FE_CONF=/risingwave_fe/conf +ENV RISINGWAVE_FE_LIB=/risingwave_fe/lib + +EXPOSE 4567 diff --git a/docker/frontend-v2/Dockerfile b/docker/frontend-v2/Dockerfile deleted file mode 100644 index 35c21b8e55a0..000000000000 --- a/docker/frontend-v2/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM ubuntu:20.04 as builder - -ENV LANG en_US.utf8 - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install make build-essential cmake protobuf-compiler curl openssl libssl-dev pkg-config - -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y - -RUN mkdir -p /risingwave - -WORKDIR /risingwave - -COPY proto proto -COPY src src -COPY rust-toolchain rust-toolchain -COPY Cargo.toml Cargo.toml - -ENV PATH /root/.cargo/bin/:$PATH - -# We need to add the `rustfmt` dependency, otherwise `risingwave_pb` will not compile -RUN rustup self update \ - && rustup set profile minimal \ - && rustup default $(cat "/risingwave/rust-toolchain") \ - && rustup component add rustfmt - -RUN cargo clean && cargo build --release - -FROM ubuntu:20.04 - -RUN mkdir -p /risingwave/bin - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl libssl-dev - -COPY --from=builder /risingwave/target/release/frontend-v2 /risingwave/bin/frontend-v2 - -EXPOSE 4566 \ No newline at end of file diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile index e48dc7e96b7d..35c21b8e55a0 100644 --- a/docker/frontend/Dockerfile +++ b/docker/frontend/Dockerfile @@ -1,31 +1,36 @@ -FROM openjdk:11.0.13-jdk-bullseye as risingwave_fe_builder +FROM ubuntu:20.04 as builder ENV LANG en_US.utf8 -ENV RISINGWAVE_FE_HOME=/risingwave_fe -ENV RISINGWAVE_FE_BUILD_ENV=docker -ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 -RUN mkdir -p $RISINGWAVE_FE_HOME/proto $RISINGWAVE_FE_HOME/legacy +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install make build-essential cmake protobuf-compiler curl openssl libssl-dev pkg-config -WORKDIR $RISINGWAVE_FE_HOME -COPY proto ./proto +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y -WORKDIR $RISINGWAVE_FE_HOME/legacy -COPY legacy ./ +RUN mkdir -p /risingwave -RUN ./gradlew build +WORKDIR /risingwave -FROM openjdk:11.0.13-jre-slim-bullseye +COPY proto proto +COPY src src +COPY rust-toolchain rust-toolchain +COPY Cargo.toml Cargo.toml -RUN mkdir dir -p /risingwave_fe/conf /risingwave_fe/lib +ENV PATH /root/.cargo/bin/:$PATH -COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/libs/risingwave-fe-runnable.jar /risingwave_fe/lib -COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/resources/main/server.properties /risingwave_fe/conf -COPY --from=risingwave_fe_builder /risingwave_fe/legacy/pgserver/build/resources/main/logback.xml /risingwave_fe/conf +# We need to add the `rustfmt` dependency, otherwise `risingwave_pb` will not compile +RUN rustup self update \ + && rustup set profile minimal \ + && rustup default $(cat "/risingwave/rust-toolchain") \ + && rustup component add rustfmt -WORKDIR /risingwave_fe +RUN cargo clean && cargo build --release -ENV RISINGWAVE_FE_CONF=/risingwave_fe/conf -ENV RISINGWAVE_FE_LIB=/risingwave_fe/lib +FROM ubuntu:20.04 -EXPOSE 4567 +RUN mkdir -p /risingwave/bin + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl libssl-dev + +COPY --from=builder /risingwave/target/release/frontend-v2 /risingwave/bin/frontend-v2 + +EXPOSE 4566 \ No newline at end of file