An overview of the

After docker-lineage-cicd is started, codes are automatically synchronized and compiled, and many parameters need to be specified. Therefore, it is considered to make its own Docker image for compilation of Lineage 18.1.

See docker lineage of the project

steps

Dockerfile

Refer to docker-lineage-cicd/Dockerfile to keep only source and ccache directory mappings, simplify unnecessary dependencies, replace Cron with Vim, use the TUNA repo, and finally execute the script set by entrypoint

docker_entrypoint.sh

Set the ccache size and git account, and enter bash

build

Docker build --network=host \ -t xhyeax/docker-lineage:v18.1.Copy the code

To install dependencies using a local HTTP proxy, the network selects host mode

run

export ANDROID_VOL=/media/xhy/a5d37cc9-d3a3-43c8-909d-178d70a6598c/Android docker run --privileged -it \ -v "$ANDROID_VOL/source:/ SRV/SRC "\ -v "$ANDROID_VOL/ccache:/ SRV /ccache" \ xhyeax/docker-lineage:v18.1Copy the code

push

You can use VSCode Docker plug-in to upload the image to the Docker Hub

Problems encountered

Build card in tzData Geographic Area:

Set environment variables in Dockerfile:

ENV DEBIAN_FRONTEND=noninteractive
Copy the code

docker_entrypoint.sh Permission denied

Add executable permission to the script and rebuild it

Permission denied at compile time

Increased — Privileged when initiating the container

Docker_entrypoint. sh Exit after the command is executed

Cause: The foreground application is not running, and the container is automatically closed. You can add the -d parameter to start the container or add the command to enter Shell at the end of the docker_entrypoint.sh script

args="$@"
if [ -z "$args" ]; then
  args="bash"
fi

exec sudo -E args
Copy the code

reference

How to fix ‘Configuring tzdata’ interactive input when building Docker images