Skip to content

Commit

Permalink
Copy resource into rpm, deb and image (#1372)
Browse files Browse the repository at this point in the history
Copy resource into rpm, deb and image

- [x] Other (please describe):
Copy resource into rpm, deb and image
  • Loading branch information
yuzhichang authored Jun 22, 2024
1 parent 40f512c commit 9465d1d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ jobs:
TZ=$(readlink -f /etc/localtime | awk -F '/zoneinfo/' '{print $2}')
sudo docker rm -f infinity_build && sudo docker run -d --privileged --name infinity_build --network=host -e TZ=$TZ -v $PWD:/infinity infiniflow/infinity_builder:centos7
- name: Modify CMakeLists
run: sed -i '/install.*TARGETS embedded_infinity_ext.*/d' src/CMakeLists.txt

- name: Build release version
run: sudo docker exec infinity_build bash -c "git config --global safe.directory \"*\" && cd /infinity && rm -fr cmake-build-release && mkdir -p cmake-build-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=amd64 -DCMAKE_JOB_POOL_LINK:STRING=link_pool -DCMAKE_JOB_POOLS:STRING=link_pool=1 -S /infinity -B /infinity/cmake-build-release && cmake --build /infinity/cmake-build-release"

- name: Download resources
run: sudo docker exec infinity_build bash -c "rm -rf resource && git clone https://github.com/infiniflow/resource.git"
run: rm -rf resource && git clone --depth=1 https://github.com/infiniflow/resource.git

- name: Build RPM and DEB
run: sudo docker exec infinity_build bash -c "cd /infinity/cmake-build-release && cpack"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
if: ${{ !cancelled() }} # always run this step even if previous steps failed
run: cat unittest_debug.log 2>/dev/null || true

- name: Download resources
run: rm -rf resource && git clone --depth=1 https://github.com/infiniflow/resource.git

- name: Install pysdk
if: ${{ !cancelled() && !failure() }}
run: sudo docker exec infinity_build bash -c "cd /infinity/ && pip uninstall -y infinity-sdk && pip install . -v --config-settings=cmake.build-type='Debug' --config-settings=build-dir='cmake-build-debug'"
Expand Down Expand Up @@ -163,6 +166,9 @@ jobs:
if: ${{ !cancelled() }} # always run this step even if previous steps failed
run: cat unittest_release.log 2>/dev/null || true

- name: Download resources
run: rm -rf resource && git clone --depth=1 https://github.com/infiniflow/resource.git

- name: Install pysdk
if: ${{ !cancelled() && !failure() }}
run: sudo docker exec infinity_build bash -c "cd /infinity/ && pip uninstall -y infinity-sdk && pip install . -v --config-settings=cmake.build-type='RelWithDebInfo' --config-settings=build-dir='cmake-build-release'"
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ set(CMAKE_INSTALL_PREFIX /usr)
install(TARGETS infinity DESTINATION bin)
install(FILES conf/infinity.service DESTINATION lib/systemd/system)
install(FILES conf/infinity_conf.toml DESTINATION etc)
#install(DIRECTORY ../resource/jieba DESTINATION ../var/infinity/resource)
install(DIRECTORY resource/jieba DESTINATION ../var/infinity/resource)
install(DIRECTORY resource/mecab DESTINATION ../var/infinity/resource)

# https://cmake.org/cmake/help/latest/cpack_gen/rpm.html
# Specify the post-install script for RPM
Expand Down
8 changes: 7 additions & 1 deletion scripts/Dockerfile_infinity
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ FROM debian:stable-slim

COPY cmake-build-release/src/infinity /usr/bin

ENTRYPOINT [ "/usr/bin/infinity" ]
# https://docs.docker.com/reference/dockerfile/#copy
# If <src> is a directory, the entire contents of the directory are copied, including filesystem metadata.
# The directory itself isn't copied, only its contents.
COPY resource/jieba /resource/jieba
COPY resource/mecab /resource/mecab

ENTRYPOINT ["bash", "-c", "cp -rf /resource /var/infinity/; exec /usr/bin/infinity"]

0 comments on commit 9465d1d

Please sign in to comment.