diff --git a/.github/workflows/docker-build-image.yml b/.github/workflows/docker-build-image.yml index a09f6264df..e891d89612 100644 --- a/.github/workflows/docker-build-image.yml +++ b/.github/workflows/docker-build-image.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: paths: - - '.github/workflows/docker-build-image.yml' + - '.github/workflows/**' - 'Dockerfile' - 'docker/**' - 'docs/minimal.toml' @@ -12,7 +12,7 @@ on: branches: - main paths: - - '.github/workflows/docker-build-image.yml' + - '.github/workflows/**' - 'Dockerfile' - 'docker/**' - 'docs/minimal.toml' diff --git a/.github/workflows/dockerhub-publish-nightly.yml b/.github/workflows/dockerhub-publish-nightly.yml new file mode 100644 index 0000000000..2670d22521 --- /dev/null +++ b/.github/workflows/dockerhub-publish-nightly.yml @@ -0,0 +1,30 @@ +name: Publish Nightly Docker image + +on: + workflow_dispatch: + schedule: + - cron: '10 20 * * *' + +jobs: + docker: + if: github.repository_owner == 'CeresDB' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set datetime + run: | + echo "BUILD_DATE=$(TZ=':Asia/Shanghai' date '+%Y%m%d%H%M%S')" >> $GITHUB_ENV + - name: Build and Push CeresDB Server Docker Image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ceresdb/ceresdb-server:nightly-${{ env.BUILD_DATE }}-${{ github.sha }} diff --git a/.github/workflows/tsbs.yml b/.github/workflows/tsbs.yml index 3ec5554c12..a193a0adb6 100644 --- a/.github/workflows/tsbs.yml +++ b/.github/workflows/tsbs.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: paths: - - '.github/workflows/tsbs.yml' + - '.github/workflows/**' - 'scrits/run-tsbs.sh' paths-ignore: schedule: @@ -31,13 +31,16 @@ jobs: restore-keys: | release-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}- release-${{ runner.os }}- - release-${{ runner.os }} - name: Ensure Disk Quota run: | make ensure-disk-quota + - name: Setup Build Environment + run: | + sudo apt update + sudo apt install --yes protobuf-compiler - name: Build server run: | - make build + make build-slim - name: Run TSBS run: | ./scripts/run-tsbs.sh diff --git a/Dockerfile b/Dockerfile index 920ef41b0d..3c398ac56f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,12 @@ FROM rust:${RUST_VERSION}-slim-bullseye as build # cache mounts below may already exist and owned by root USER root -RUN apt update && apt install --yes gcc g++ libssl-dev pkg-config cmake && rm -rf /var/lib/apt/lists/* +RUN apt update && apt install --yes gcc g++ libssl-dev pkg-config cmake protobuf-compiler && rm -rf /var/lib/apt/lists/* COPY . /ceresdb WORKDIR /ceresdb -RUN make build +RUN make build-slim ## CeresDB FROM ubuntu:20.04 @@ -23,7 +23,7 @@ RUN apt update && \ ENV RUST_BACKTRACE 1 -COPY --from=build /ceresdb/target/release/ceresdb-server /usr/bin/ceresdb-server +COPY --from=build /ceresdb/target/release-slim/ceresdb-server /usr/bin/ceresdb-server RUN chmod +x /usr/bin/ceresdb-server COPY ./docker/entrypoint.sh /entrypoint.sh diff --git a/scripts/run-tsbs.sh b/scripts/run-tsbs.sh index 2ebc72af6d..8f4dbe9578 100755 --- a/scripts/run-tsbs.sh +++ b/scripts/run-tsbs.sh @@ -33,7 +33,7 @@ cleanup() { mkdir -p ${LOG_DIR} -nohup ./target/release/ceresdb-server -c ${CONFIG_FILE} > ${LOG_DIR}/server.log & +nohup ./target/release-slim/ceresdb-server -c ${CONFIG_FILE} > ${LOG_DIR}/server.log & git clone -b feat-ceresdb --depth 1 --single-branch https://github.com/CeresDB/tsbs.git