# How to build Mozc in Docker [](https://github.com/google/mozc/actions/workflows/linux.yaml) [](https://github.com/google/mozc/actions/workflows/android.yaml) ## Summary If you are not sure what the following commands do, please check the descriptions below and make sure the operations before running them. ``` curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile docker build --rm --tag mozc_ubuntu24.04 . docker create --interactive --tty --name mozc_build mozc_ubuntu24.04 docker start mozc_build docker exec mozc_build bazelisk build package --config oss_linux --config release_build docker cp mozc_build:/home/mozc_builder/work/mozc/src/bazel-bin/unix/mozc.zip . ``` ## Introduction Docker containers are available to build Mozc binaries for Linux desktop. ## System Requirements Currently, only Ubuntu 24.04 is tested to host the Docker container to build Mozc. * [Dockerfile](https://github.com/google/mozc/blob/master/docker/ubuntu24.04/Dockerfile) for Ubuntu 24.04 ## Build in Docker ### Set up Ubuntu 24.04 Docker container ``` curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile docker build --rm --tag mozc_ubuntu24.04 . docker create --interactive --tty --name mozc_build mozc_ubuntu24.04 ``` You may need to execute `docker` with `sudo` (e.g. `sudo docker build ...`). Notes * `mozc_ubuntu24.04` is a Docker image name (customizable). * `mozc_build` is a Docker container name (customizable). * Don't forget to rebuild Docker container when Dockerfile is updated. ### Build Mozc in Docker container ``` docker start mozc_build docker exec mozc_build bazelisk build package --config oss_linux --config release_build docker cp mozc_build:/home/mozc_builder/work/mozc/src/bazel-bin/unix/mozc.zip . ``` `mozc.zip` contains built files. Notes * You might want to execute `docker stop` after build. * `mozc_build` is the Docker container name created in the above section. ----- ## Build Mozc for Linux Desktop ``` bazelisk build package --config oss_linux --config release_build ``` Note: You might want to execute `docker start --interactive mozc_build` to enter the docker container before the above command. `package` builds Mozc binaries and locates them into `mozc.zip` as follows. | build rule | install path | | ------------------------------ | ------------ | | //server:mozc_server | /usr/lib/mozc/mozc_server | | //gui/tool:mozc_tool | /usr/lib/mozc/mozc_tool | | //renderer:mozc_renderer | /usr/lib/mozc/mozc_renderer | | //unix/ibus/ibus_mozc | /usr/lib/ibus-mozc/ibus-engine-mozc | | //unix/ibus:gen_mozc_xml | /usr/share/ibus/component/mozc.xml | | //unix:icons | /usr/share/ibus-mozc/... | | //unix:icons | /usr/share/icons/mozc/... | | //unix/emacs:mozc.el | /usr/share/emacs/site-lisp/emacs-mozc/mozc.el | | //unix/emacs:mozc_emacs_helper | /usr/bin/mozc_emacs_helper | Install paths are configurable by modifying [src/config.bzl](https://github.com/google/mozc/blob/master/src/config.bzl). ### Unit tests #### Run all tests ``` bazelisk test ... --config oss_linux --build_tests_only -c dbg ``` * `...` means all targets under the current and subdirectories. ### Run tests under the specific directories ``` bazelisk test base/... composer/... --config oss_linux --build_tests_only -c dbg ``` * `