Skip to content

Commit

Permalink
rewrite Dockerfile to include plugins (rime#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored and graphemecluster committed Sep 8, 2023
1 parent 36092b0 commit c6fea51
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 36 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout last commit
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt install -y clang-format
- name: Lint
Expand All @@ -30,3 +30,7 @@ jobs:
windows:
needs: lint
uses: ./.github/workflows/windows-build.yml

docker:
needs: lint
uses: ./.github/workflows/docker-build.yml
14 changes: 14 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Docker build
on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout last commit
uses: actions/checkout@v4
- name: Build with plugins
run: docker build -t librime .
2 changes: 1 addition & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
compiler: [g++, clang]
steps:
- name: Checkout last commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
submodules: recursive
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
RIME_PLUGINS: ${{ inputs.rime_plugins }}
steps:
- name: Checkout last commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
submodules: recursive
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
RIME_PLUGINS: ${{ inputs.rime_plugins }}
steps:
- name: Checkout last commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}
submodules: recursive
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
uses: msys2/setup-msys2@v2

- name: Checkout last commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}

Expand Down
64 changes: 33 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
FROM ubuntu:18.04
FROM debian:12.1

RUN apt update
RUN apt install -y \
cmake \
libboost-dev \
libboost-filesystem-dev libboost-regex-dev libboost-system-dev libboost-locale-dev \
libgoogle-glog-dev \
libgtest-dev \
libyaml-cpp-dev \
libleveldb-dev \
libmarisa-dev
RUN apt update && apt install -y \
git \
build-essential \
cmake \
ninja-build \
libboost-dev \
libboost-filesystem-dev \
libboost-regex-dev \
libboost-system-dev \
libboost-locale-dev \
libgoogle-glog-dev \
libgtest-dev \
libyaml-cpp-dev \
libleveldb-dev \
libmarisa-dev \
libopencc-dev \
liblua5.4-dev

RUN apt install -y git
COPY / /librime
WORKDIR /librime/plugins
RUN git clone https://github.com/rime/librime-charcode charcode && \
git clone https://github.com/hchunhui/librime-lua lua && \
git clone https://github.com/lotem/librime-octagram octagram

# Manually install libopencc
RUN git clone https://github.com/BYVoid/OpenCC.git
WORKDIR OpenCC/
RUN apt install -y doxygen
RUN make
RUN make install
WORKDIR /librime
RUN cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DENABLE_LOGGING:BOOL=ON \
-DBUILD_TEST:BOOL=ON \
-DBUILD_STATIC:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON
RUN cmake --build build

# Fix libgtest problem during compiling
WORKDIR /usr/src/gtest
RUN cmake CMakeLists.txt
RUN make
#copy or symlink libgtest.a and libgtest_main.a to your /usr/lib folder
RUN cp *.a /usr/lib

# Build librime
WORKDIR /
RUN git clone https://github.com/rime/librime.git
WORKDIR librime/
RUN make
RUN make install
WORKDIR /librime/build
RUN ctest

0 comments on commit c6fea51

Please sign in to comment.