From d569f615fabd238b479bb6e44a8288b2eea4e0b1 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sun, 5 May 2024 11:07:15 +0000 Subject: [PATCH] Add a `Dockerfile` for Ubuntu 24.04 As the initial step towards #924, this commit introduces a Dockerfile for Ubuntu 24.04 so that developers can build Mozc binaries for Ubuntu 24.04 and Android. #codelealth PiperOrigin-RevId: 630801826 --- docker/ubuntu24.04/Dockerfile | 76 +++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docker/ubuntu24.04/Dockerfile diff --git a/docker/ubuntu24.04/Dockerfile b/docker/ubuntu24.04/Dockerfile new file mode 100644 index 000000000..8d2a1943c --- /dev/null +++ b/docker/ubuntu24.04/Dockerfile @@ -0,0 +1,76 @@ +# Copyright 2010-2020, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Build instructions with this Dockerfile. +# https://github.com/google/mozc/blob/master/docs/build_mozc_in_docker.md + +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND noninteractive + +# Package installation +RUN apt-get update --fix-missing +RUN apt-get upgrade -y +## Common packages for linux build environment +RUN apt-get install -y python3 pkg-config git curl unzip g++ gcc +## Packages for linux desktop version +RUN apt-get install -y libibus-1.0-dev libglib2.0-dev qt6-base-dev libgl-dev +## Packages for misc tools +RUN apt-get install -y nano +## Setting up Android SDK requires OpenJDK. +RUN apt-get install -y openjdk-17-jdk + +# Working environemnt +ENV HOME /home/mozc_builder +RUN useradd --create-home --shell /bin/bash --base-dir /home mozc_builder +USER mozc_builder +RUN mkdir -p /home/mozc_builder/bin +ENV PATH "${PATH}:/home/mozc_builder/bin" +RUN mkdir -p /home/mozc_builder/work +WORKDIR /home/mozc_builder/work + +## Set up Bazel +RUN curl -LO https://github.com/bazelbuild/bazel/releases/download/7.1.1/bazel-7.1.1-installer-linux-x86_64.sh +RUN bash bazel-7.1.1-installer-linux-x86_64.sh --user +RUN rm bazel-7.1.1-installer-linux-x86_64.sh + +## Set up Android SDK and NDK +ENV ANDROID_HOME /home/mozc_builder/Android/Sdk +RUN mkdir -p ${ANDROID_HOME} +RUN curl -LO https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip && unzip commandlinetools-linux-10406996_latest.zip -d ${ANDROID_HOME} && rm commandlinetools-linux-10406996_latest.zip +RUN yes | ${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} "cmdline-tools;latest" "platforms;android-33" "build-tools;33.0.2" "platform-tools" "ndk;25.2.9519653" +ENV ANDROID_NDK_HOME ${ANDROID_HOME}/ndk/25.2.9519653 + +# check out Mozc source with submodules +RUN mkdir /home/mozc_builder/work/mozc +# COPY --chown=mozc_builder:mozc_builder src/ /home/mozc_builder/work/mozc/src/ +RUN git clone https://github.com/google/mozc.git -b master --single-branch --recursive + +WORKDIR /home/mozc_builder/work/mozc/src +ENTRYPOINT bash