diff --git a/.env b/.env index 6cf0d55e08342..578cd5de2b326 100644 --- a/.env +++ b/.env @@ -1,11 +1,9 @@ # to define environment variables available to docker-compose.yml -# subman creds for RHEL builds -SUBMAN_USER= -SUBMAN_PASS= - -IMAGE_REPO=quay.io/redhat-et -IMAGE_ARCH=amd64 +# If this is uncommented it will pull and not rebuild +# IMAGE_REPO=quay.io/grpereir +IMAGE_REPO=quay.io/ai-lab +IMAGE_ARCH=arm64 OS_NAME=rhel9 # for services.builder.image in docker-compose.yml diff --git a/.github/workflows/publish-builder.yaml b/.github/workflows/publish-builder.yaml index d8d0029fd44d5..e8f2f5310486e 100644 --- a/.github/workflows/publish-builder.yaml +++ b/.github/workflows/publish-builder.yaml @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu20.04, amazonlinux2023, rockylinux8] + os: [ubuntu20.04, amazonlinux2023, rockylinux8, rhel9] env: OS_NAME: ${{ matrix.os }} IMAGE_ARCH: ${{ matrix.arch }} diff --git a/.github/workflows/rhel9-milvus.yaml b/.github/workflows/rhel9-milvus.yaml deleted file mode 100644 index 4df4477f6a247..0000000000000 --- a/.github/workflows/rhel9-milvus.yaml +++ /dev/null @@ -1,91 +0,0 @@ -name: Publish Builder -# TODO: do not trigger action for some document file update - -# This workflow is triggered on pushes or pull request to the repository. -on: - push: - # file paths to consider in the event. Optional; defaults to all. - paths: - - 'build/docker/builder/cpu/**' - - '.github/workflows/publish-builder.yaml' - - '!**.md' - pull_request: - # file paths to consider in the event. Optional; defaults to all. - paths: - - 'build/docker/builder/cpu/**' - - '.github/workflows/publish-builder.yaml' - - '!**.md' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - publish-builder: - name: ${{ matrix.arch }} ${{ matrix.os }} - runs-on: ubuntu-latest - timeout-minutes: 500 - strategy: - fail-fast: false - matrix: - os: [rockylinux8] - arch: [arm64] - env: - OS_NAME: ${{ matrix.os }} - IMAGE_ARCH: ${{ matrix.arch }} - steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - if: ${{ ! startsWith(runner.name, 'self') }} # skip this step if it is self-hosted runner - with: - root-reserve-mb: 20480 - # overprovision-lvm: 'true' - swap-size-mb: 1024 - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - - name: Checkout - uses: actions/checkout@v2 - - name: Get version from system time after release step - id: extracter - run: | - echo "::set-output name=version::$(date +%Y%m%d)" - echo "::set-output name=sha_short::$(git rev-parse --short=7 HEAD)" - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - milvusdb/milvus-env - tags: | - type=raw,enable=true,value=${{ matrix.os }}-{{date 'YYYYMMDD'}}-{{sha}} - type=raw,enable=true,value=${{ matrix.os }}-latest - # - name: Setup upterm session - # uses: lhotari/action-upterm@v1 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - file: build/docker/builder/cpu/${{ matrix.os }}/Dockerfile - - name: Bump Builder Version - uses: ./.github/actions/bump-builder-version - if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04' - with: - tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}" - type: cpu - token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }} diff --git a/.gitignore b/.gitignore index 17c251a7be6af..83cd1691917a7 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,9 @@ docker-compose-devcontainer.yml.tmp # Docker generated cache file .docker/ +# Private `subscription-manager` credentials for rhel builds +.env.rhel + **/_artifacts/** # proxy @@ -46,6 +49,7 @@ proxy-go/proxy-go # Compiled source bin/ lib/ +configs/ *.a *.so *.so.* diff --git a/build/docker/builder/cpu/rhel9/Dockerfile b/build/docker/builder/cpu/rhel9/Dockerfile index 69a241bfe9f3c..df01b1a398f5e 100644 --- a/build/docker/builder/cpu/rhel9/Dockerfile +++ b/build/docker/builder/cpu/rhel9/Dockerfile @@ -36,19 +36,20 @@ RUN dnf install -y make cmake automake gcc gcc-c++ \ RUN alias python3='python3.11' -# taken from .env file -RUN subscription-manager register --username $SUBMAN_USER --password $SUBMAN_PASS +# Assumes you have a valid subman subscription COPY build/docker/builder/cpu/rhel9/install-rpms.sh /root/install-rpms.sh RUN chmod +x /root/install-rpms.sh -RUN TARGETARCH=$TARGETARCH /root/install-rpms.sh +RUN /root/install-rpms.sh # Install conan and Go RUN python3.11 -m pip install conan==1.61.0 COPY build/docker/builder/cpu/rhel9/install-go.sh /root/install-go.sh RUN chmod +x /root/install-go.sh -RUN TARGETARCH=$TARGETARCH /root/install-go.sh +RUN source /root/install-go.sh + +RUN mkdir -p /.cache/go-build && chmod -R 777 /.cache/go-build RUN curl https://sh.rustup.rs -sSf | \ sh -s -- --default-toolchain=1.73 -y @@ -57,14 +58,12 @@ ENV PATH=/root/.cargo/bin:/usr/local/bin:/usr/local/go/bin:$PATH ENV VCPKG_FORCE_SYSTEM_BINARIES 1 -# RUN mkdir /opt/vcpkg && \ -# wget -qO- vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/master.tar.gz | tar --strip-components=1 -xz -C /opt/vcpkg && \ -# rm -rf vcpkg.tar.gz -COPY --from=vcpkg-installer /opt/vcpkg /opt/vcpkg +RUN mkdir /opt/vcpkg && \ + wget -qO- vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/master.tar.gz | tar --strip-components=1 -xz -C /opt/vcpkg && \ + rm -rf vcpkg.tar.gz COPY --from=vcpkg-installer /root/.cache/vcpkg /root/.cache/vcpkg COPY --chown=0:0 build/docker/builder/entrypoint.sh / -USER 1001 ENTRYPOINT [ "/entrypoint.sh" ] CMD ["tail", "-f", "/dev/null"] diff --git a/build/docker/builder/cpu/rhel9/install-go.sh b/build/docker/builder/cpu/rhel9/install-go.sh index 641d0bc60f433..5b13c9e67e88f 100644 --- a/build/docker/builder/cpu/rhel9/install-go.sh +++ b/build/docker/builder/cpu/rhel9/install-go.sh @@ -35,7 +35,11 @@ else fi export PATH="$GOPATH/bin:$GOROOT/bin:$PATH" +export GOPROXY="https://proxy.golang.org,direct" +export GOSUMDB="sum.golang.org" +export GOMODCACHE="$GOPATH/pkg/mod" +export GOCACHE="$GOPATH/.cache" -mkdir -p "$GOPATH/src" "$GOPATH/bin" +mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg" "$GOCACHE" go clean --modcache chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR) \ No newline at end of file diff --git a/build/docker/milvus/rhel9/Dockerfile b/build/docker/milvus/rhel9/Dockerfile index 760088c015820..ccb6594e3c212 100644 --- a/build/docker/milvus/rhel9/Dockerfile +++ b/build/docker/milvus/rhel9/Dockerfile @@ -17,6 +17,8 @@ ARG TARGETARCH # assumes repo of codeready-builder-for-rhel-9- RUN dnf install -y wget libgomp libaio libatomic +USER 0 + COPY build/docker/milvus/rhel9/install-openblas.sh /home/install-openblas.sh RUN chmod +x /home/install-openblas.sh RUN TARGETARCH=$TARGETARCH /home/install-openblas.sh @@ -38,6 +40,7 @@ ENV MALLOC_CONF=background_thread:true # Add Tini ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-$TARGETARCH /tini RUN chmod +x /tini -ENTRYPOINT ["/tini", "--"] -WORKDIR /milvus \ No newline at end of file +USER 1001 +ENTRYPOINT ["/tini", "--"] +WORKDIR /milvus diff --git a/docker-compose.yml b/docker-compose.yml index 5ad8291cb6967..b89e9f2c4ad6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,8 +33,6 @@ services: MINIO_ADDRESS: ${MINIO_ADDRESS} CONAN_USER_HOME: /home/milvus AZURE_STORAGE_CONNECTION_STRING: ${AZURITE_CONNECTION_STRING} - SUBMAN_USER: ${SUBMAN_USER} - SUBMAN_PASS: ${SUBMAN_PASS} volumes: &builder-volumes - .:/go/src/github.com/milvus-io/milvus:delegated - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-ccache:/ccache:delegated