Fix RocksDB docker build

This commit is contained in:
Chris Lu
2025-09-16 23:22:40 -07:00
parent 58e0c1b330
commit f9f2609e63
3 changed files with 13 additions and 11 deletions

View File

@@ -53,6 +53,8 @@ jobs:
context: ./docker context: ./docker
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
file: ./docker/Dockerfile.rocksdb_large file: ./docker/Dockerfile.rocksdb_large
build-args: |
BRANCH=${{ github.sha }}
platforms: linux/amd64 platforms: linux/amd64
tags: ${{ steps.docker_meta.outputs.tags }} tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }} labels: ${{ steps.docker_meta.outputs.labels }}

View File

@@ -1,16 +1,16 @@
FROM golang:1.24 as builder FROM golang:1.24 AS builder
RUN apt-get update RUN apt-get update
RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev
ENV ROCKSDB_VERSION v10.2.1 ENV ROCKSDB_VERSION=v10.5.1
# build RocksDB # build RocksDB
RUN cd /tmp && \ RUN cd /tmp && \
git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb --depth 1 --single-branch --branch $ROCKSDB_VERSION && \ git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb --depth 1 --single-branch --branch $ROCKSDB_VERSION && \
cd rocksdb && \ cd rocksdb && \
PORTABLE=1 make static_lib && \ PORTABLE=1 make -j"$(nproc)" static_lib && \
make install-static make install-static
ENV CGO_CFLAGS "-I/tmp/rocksdb/include" ENV CGO_CFLAGS="-I/tmp/rocksdb/include"
ENV CGO_LDFLAGS "-L/tmp/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd" ENV CGO_LDFLAGS="-L/tmp/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"

View File

@@ -1,24 +1,24 @@
FROM golang:1.24 as builder FROM golang:1.24 AS builder
RUN apt-get update RUN apt-get update
RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev
ENV ROCKSDB_VERSION v10.2.1 ENV ROCKSDB_VERSION=v10.5.1
# build RocksDB # build RocksDB
RUN cd /tmp && \ RUN cd /tmp && \
git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb --depth 1 --single-branch --branch $ROCKSDB_VERSION && \ git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb --depth 1 --single-branch --branch $ROCKSDB_VERSION && \
cd rocksdb && \ cd rocksdb && \
PORTABLE=1 make static_lib && \ PORTABLE=1 make -j"$(nproc)" static_lib && \
make install-static make install-static
ENV CGO_CFLAGS "-I/tmp/rocksdb/include" ENV CGO_CFLAGS="-I/tmp/rocksdb/include"
ENV CGO_LDFLAGS "-L/tmp/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd" ENV CGO_LDFLAGS="-L/tmp/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
# build SeaweedFS # build SeaweedFS
RUN mkdir -p /go/src/github.com/seaweedfs/ RUN mkdir -p /go/src/github.com/seaweedfs/
RUN git clone https://github.com/seaweedfs/seaweedfs /go/src/github.com/seaweedfs/seaweedfs RUN git clone https://github.com/seaweedfs/seaweedfs /go/src/github.com/seaweedfs/seaweedfs
ARG BRANCH=${BRANCH:-master} ARG BRANCH=master
RUN cd /go/src/github.com/seaweedfs/seaweedfs && git checkout $BRANCH RUN cd /go/src/github.com/seaweedfs/seaweedfs && git checkout $BRANCH
RUN cd /go/src/github.com/seaweedfs/seaweedfs/weed \ RUN cd /go/src/github.com/seaweedfs/seaweedfs/weed \
&& export LDFLAGS="-X github.com/seaweedfs/seaweedfs/weed/util/version.COMMIT=$(git rev-parse --short HEAD)" \ && export LDFLAGS="-X github.com/seaweedfs/seaweedfs/weed/util/version.COMMIT=$(git rev-parse --short HEAD)" \