-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- smaller image size (21MB) - user defined command arguments
- Loading branch information
Showing
3 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,48 @@ | ||
FROM rust as builder | ||
|
||
RUN apt update && apt install -y clang librime-dev | ||
|
||
WORKDIR /app | ||
|
||
FROM alpine:edge as builder | ||
|
||
# 1. build rime plugins from source | ||
## 1.1 install dependencies | ||
RUN apk add --no-cache boost-dev capnproto-dev chrpath cmake \ | ||
glog-dev leveldb-dev libmarisa-dev opencc-dev \ | ||
samurai yaml-cpp-dev git bash clang gtest-dev | ||
|
||
## 1.1 clone git repo | ||
RUN git clone https://github.com/rime/librime --depth=1 | ||
WORKDIR /librime | ||
RUN bash install-plugins.sh \ | ||
rime/librime-charcode \ | ||
hchunhui/librime-lua \ | ||
lotem/librime-octagram \ | ||
rime/librime-predict | ||
|
||
## 1.2 get lua source code | ||
WORKDIR /librime/plugins/lua | ||
RUN bash action-install.sh | ||
|
||
## 1.3 build librime | ||
WORKDIR /librime | ||
RUN cmake -B build -G Ninja \ | ||
-DCMAKE_BUILD_TYPE:STRING=Release \ | ||
-DCMAKE_INSTALL_PREFIX=/usr \ | ||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ | ||
-DBOOST_USE_CXX11=ON \ | ||
-DBUILD_DATA=ON \ | ||
-DBUILD_MERGED_PLUGINS=OFF \ | ||
-DBUILD_TEST=ON \ | ||
-DENABLE_EXTERNAL_PLUGINS=ON | ||
RUN cmake --build build | ||
|
||
# 2. build rime-ls | ||
RUN apk add --no-cache rust cargo musl-dev clang16-libclang librime-dev | ||
WORKDIR /src | ||
COPY . . | ||
|
||
RUN cargo build --release | ||
|
||
FROM debian:12 | ||
|
||
RUN apt update && apt install -y librime-dev | ||
|
||
# 3. build rime-ls image | ||
FROM alpine:edge | ||
RUN apk add --no-cache librime | ||
WORKDIR /app | ||
|
||
COPY --from=builder /app/target/release/rime_ls /app | ||
|
||
COPY --from=builder /src/target/release/rime_ls /app | ||
COPY --from=builder /librime/build/lib/rime-plugins/ /usr/lib/rime-plugins/ | ||
EXPOSE 9257 | ||
|
||
CMD ["/app/rime_ls","--listen","0.0.0.0:9257"] | ||
ENTRYPOINT ["./rime_ls"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
version: "3" | ||
|
||
version: '3' | ||
services: | ||
rime-ls: | ||
restart: always | ||
build: . | ||
restart: always | ||
# [optional] use over TCP | ||
command: --listen 0.0.0.0:9257 | ||
ports: | ||
- 9257:9257 | ||
volumes: | ||
# [optional] mount your rime shared data | ||
- /path/to/rime-data:/usr/share/rime-data | ||
# mount your rime user data | ||
- /root/.config/my_rime:/root/.local/share/rime-ls | ||
- /path/to/user/data:/root/.local/share/rime-ls |