Add Docker setup for Chromium Android build
Adds instructions for using Docker to build Chromium for Android. This change includes a guide for creating a Docker image with all needed tools and dependencies, running the container, and building Chromium inside it. Previously, setting up the build environment required manual steps that were prone to errors. The new Docker setup makes it easier and more co- nsistent. Change-Id: Ia0211f7e8c40c86d172c42e292c82833aa1a2a90 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5870117 Reviewed-by: Alexander Cooper <alcooper@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Brian Sheedy <bsheedy@chromium.org> Cr-Commit-Position: refs/heads/main@{#1369455}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2fc93a345c
commit
5ae3480c4a
1
AUTHORS
1
AUTHORS
@ -1010,6 +1010,7 @@ Mitchell Cohen <mitchell@agilebits.com>
|
||||
Miyoung Shin <myid.shin@navercorp.com>
|
||||
Mohamed I. Hammad <ibraaaa@gmail.com>
|
||||
Mohamed Mansour <m0.interactive@gmail.com>
|
||||
Mohamed Hany Youns <mohamedhyouns@gmail.com>
|
||||
Mohammad Azam <m.azam@samsung.com>
|
||||
Mohammed Wajahat Ali Siddiqui <wajahat.s@samsung.com>
|
||||
Mohan Reddy <mohan.reddy@samsung.com>
|
||||
|
@ -503,3 +503,12 @@ committing code to chromium.
|
||||
3. Go to
|
||||
[http://storage.googleapis.com/chrome-browser-components/BUILD\_ID\_FROM\_STEP\_2/index.html](http://storage.googleapis.com/chrome-browser-components/BUILD_ID_FROM_STEP_2/index.html)
|
||||
4. Download the listed files and follow the steps in the README.
|
||||
|
||||
### Building with Docker
|
||||
|
||||
To build Chromium for Android using Docker, please follow the
|
||||
instructions in the [Docker in Linux build instructions](/docs/linux/build_instructions.md#docker).
|
||||
|
||||
*** note
|
||||
**Note:** You need install the [Android dependencies](#install-additional-build-dependencies) after setting up the [Build dependencies](/docs/linux/build_instructions.md#install-additional-build-dependencies).
|
||||
***
|
||||
|
@ -732,7 +732,10 @@ WORKDIR /chromium/src
|
||||
|
||||
# Expose any necessary ports (if needed)
|
||||
# EXPOSE 8080
|
||||
RUN useradd -u 1000 chrom-d
|
||||
|
||||
# Create a dummy user and group to avoid permission issues
|
||||
RUN groupadd -g 1001 chrom-d && \
|
||||
useradd -u 1000 -g 1001 -m chrom-d
|
||||
|
||||
# Create normal user with name "chrom-d". Optional and you can use root but
|
||||
# not advised.
|
||||
@ -754,7 +757,7 @@ $ docker build -t chrom-b .
|
||||
3. Run container as root to install dependencies
|
||||
|
||||
```shell
|
||||
$ docker run --rm \ # close instance upon exit
|
||||
$ docker run
|
||||
-it \ # Run docker interactively
|
||||
--name chrom-b \ # with name "chrom-b"
|
||||
-u root \ # with user root
|
||||
@ -763,6 +766,11 @@ $ docker run --rm \ # close instance upon exit
|
||||
chrom-b # Run container with image name "chrom-b"
|
||||
```
|
||||
|
||||
*** note
|
||||
**Note:** When running the command as a single line in bash, please remove the
|
||||
comments (after the `#`) to avoid breaking the command.
|
||||
***
|
||||
|
||||
4. Install dependencies:
|
||||
|
||||
```shell
|
||||
@ -771,13 +779,32 @@ $ docker run --rm \ # close instance upon exit
|
||||
|
||||
5. [Run hooks](#run-the-hooks) (On docker or machine if you installed depot_tools on machine)
|
||||
|
||||
*** note
|
||||
**Before running hooks:** Ensure that all directories within
|
||||
`third_party` are added as safe directories in Git. This is required
|
||||
when running in the container because the ownership of the `src/`
|
||||
directory (e.g., `chrom-b`) differs from the current user
|
||||
(e.g., `root`). To prevent Git **warnings** about "dubious ownership"
|
||||
run the following command after installing the dependencies:
|
||||
|
||||
```shell
|
||||
# Loop through each directory in /chromium/src/third_party and add
|
||||
# them as safe directories in Git
|
||||
$ for dir in /chromium/src/third_party/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
git config --global --add safe.directory "$dir"
|
||||
fi
|
||||
done
|
||||
```
|
||||
***
|
||||
|
||||
6. Exit container
|
||||
|
||||
7. Save container image with tag-id name `dpv1.0`. Run this on the machine, not in container
|
||||
|
||||
```shell
|
||||
# Get docker running instances, copy the id you get
|
||||
$ docker ps
|
||||
# Get docker running/stopped containers, copy the "chrom-b" id
|
||||
$ docker container ls -a
|
||||
# Save/tag running docker container with name "chrom-b" with "dpv1.0"
|
||||
# You can choose any tag name you want but propagate name accordingly
|
||||
# You will need to create new tags when working on different parts of
|
||||
@ -799,3 +826,8 @@ $ docker run --rm \ # close instance upon exit
|
||||
-v /path/on/machine/to/depot_tools:/depot_tools \ # With depot_tools mounted
|
||||
chrom-b:dpv1.0 # Run container with image name "chrom-b" and tag dpv1.0
|
||||
```
|
||||
|
||||
*** note
|
||||
**Note:** When running the command as a single line in bash, please remove the
|
||||
comments (after the `#`) to avoid breaking the command.
|
||||
***
|
||||
|
Reference in New Issue
Block a user