1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-11-09 10:09:56 +01:00

Move the mirror to a separate volume

This commit is contained in:
Nicola Corna 2017-12-19 23:25:42 +01:00
parent 1795489a83
commit 8d7ef9dc73
3 changed files with 8 additions and 96 deletions

@ -4,6 +4,7 @@ MAINTAINER Nicola Corna <nicola@corna.info>
# Environment variables
#######################
ENV MIRROR_DIR /srv/mirror
ENV SRC_DIR /srv/src
ENV TMP_DIR /srv/tmp
ENV CCACHE_DIR /srv/ccache
@ -126,6 +127,7 @@ ENV OPENDELTA_BUILDS_JSON ''
# Create Volume entry points
############################
VOLUME $MIRROR_DIR
VOLUME $SRC_DIR
VOLUME $TMP_DIR
VOLUME $CCACHE_DIR
@ -142,6 +144,7 @@ COPY src/ /root/
# Create missing directories
############################
RUN mkdir -p $MIRROR_DIR
RUN mkdir -p $SRC_DIR
RUN mkdir -p $TMP_DIR
RUN mkdir -p $CCACHE_DIR

@ -28,97 +28,6 @@ You can configure the Docker by passing custom environment variables to it. See
## How to use
### Simple mode
build cm14.1 LineageOS for `hammerhead` with default settings
```
docker run \
--restart=always \
-d \
-e "USER_NAME=John Doe" \
-e "USER_MAIL=john.doe@awesome.email" \
-e "DEVICE_LIST=hammerhead" \
-v "/home/user/ccache:/srv/ccache" \
-v "/home/user/source:/srv/src" \
-v "/home/user/zips:/srv/zips" \
lineageos4microg/docker-lineage-cicd
```
### Advanced mode
build cm-13.0 LineageOS for `hammerhead` and `bullhead`.
Instead of scheduling the execution, build it now and exit.
For each device, create a subdir `device_codename` in /home/user/zips and move the builds there.
```
docker run \
--cap-add=SYS_ADMIN \
-d \
-e "USER_NAME=John Doe" \
-e "USER_MAIL=john.doe@awesome.email" \
-e "BRANCH_NAME=cm-13.0" \
-e "DEVICE_LIST=hammerhead,bullhead" \
-e "CRONTAB_TIME=now" \
-e "ZIP_SUBDIR=true" \
-v "/home/user/ccache:/srv/ccache" \
-v "/home/user/source:/srv/src" \
-v "/home/user/zips:/srv/zips" \
lineageos4microg/docker-lineage-cicd
```
### Expert mode
build cm-14.1 LineageOS for a device that doesn't exist inside the main project, but comes from a special manifest (has to be created inside `/home/user/local_manifests/`). For each device, create a subdir `device_codename` in /home/user/zips and move the builds there. Start the builds every Sunday at 10:00 UTC.
Finally provide a custom OTA URL for this ROM so users can update using built-in OTA Updater.
```
docker run \
--restart=always \
--cap-add=SYS_ADMIN \
-d \
-e "USER_NAME=John Doe" \
-e "USER_MAIL=john.doe@awesome.email" \
-e "BRANCH_NAME=cm-14.1" \
-e "DEVICE_LIST=n80xx" \
-e "OTA_URL=http://cool.domain/api" \
-e "CRONTAB_TIME=0 10 * * Sun" \
-e "ZIP_SUBDIR=true" \
-v "/home/user/ccache:/srv/ccache" \
-v "/home/user/source:/srv/src" \
-v "/home/user/zips:/srv/zips" \
-v "/home/user/local_manifests:/srv/local_manifests" \
lineageos4microg/docker-lineage-cicd
```
### Custom mode
You can also apply some modifications to the LineageOS code before building it.
```
docker run \
--name=lineage-$(date +%Y%m%d_%H%M) \
--cap-add=SYS_ADMIN \
-d \
-e "USER_NAME=John Doe" \
-e "USER_MAIL=john.doe@awesome.email" \
-e "WITH_SU=false" \
-e "RELEASE_TYPE=myrelease" \
-e "BRANCH_NAME=cm-14.1" \
-e "DEVICE_LIST=$DEVICES" \
-e "OTA_URL=http://cool.domain/api" \
-e "CRONTAB_TIME=now" \
-e "SIGNATURE_SPOOFING=restricted" \
-e "CUSTOM_PACKAGES=GmsCore GsfProxy FakeStore FDroid FDroidPrivilegedExtension MozillaNlpBackend NominatimNlpBackend com.google.android.maps.jar" \
-e "SIGN_BUILDS=true" \
-e "CLEAN_OUTDIR=false" \
-e "CLEAN_AFTER_BUILD=true" \
-e "ZIP_SUBDIR=true" \
-e "LOGS_SUBDIR=true" \
-e "DELETE_OLD_ZIPS=3" \
-e "DELETE_OLD_LOGS=3" \
-v "/home/user/cache:/srv/ccache" \
-v "/home/user/lineage:/srv/src" \
-v "/home/user/zips:/srv/zips" \
-v "/home/user/lineage_manifests:/srv/local_manifests" \
-v "/home/user/lineage_keys:/srv/keys" \
-v "/home/user/logs:/srv/logs" \
-v "/home/user/lineage_scripts:/srv/userscripts" \
lineageos4microg/docker-lineage-cicd
```
### Multiple devices, multiple branches
Specify the branches and the devices in the corresponding variables, separated by a comma.
This example is the build script used for [LineageOS for microG](https://lineage.microg.org), which has integrated microG apps and F-Droid (with F-Droid Privileged Extension).
@ -148,6 +57,7 @@ docker run \
-e "DELETE_OLD_LOGS=3" \
-e "CCACHE_SIZE=540G" \
-v "/home/user/cache:/srv/ccache" \
-v "/home/user/mirror:/srv/mirror" \
-v "/home/user/lineage:/srv/src" \
-v "/home/user/zips:/srv/zips" \
-v "/home/user/lineage_manifests:/srv/local_manifests" \

@ -52,8 +52,7 @@ mkdir -p "$TMP_DIR/device"
mkdir -p "$TMP_DIR/workdir"
mkdir -p "$TMP_DIR/merged"
mkdir -p "$SRC_DIR/mirror"
cd "$SRC_DIR/mirror"
cd "$MIRROR_DIR"
if [ ! -d .repo ]; then
echo ">> [$(date)] Initializing mirror repository"
@ -61,7 +60,7 @@ if [ ! -d .repo ]; then
fi
# Copy local manifests to the appropriate folder in order take them into consideration
echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to 'mirror/.repo/local_manifests/'"
echo ">> [$(date)] Copying '$LMANIFEST_DIR/*.xml' to '.repo/local_manifests/'"
mkdir -p .repo/local_manifests
rsync -a --delete --include '*.xml' --exclude '*' "$LMANIFEST_DIR/" .repo/local_manifests/
@ -101,7 +100,7 @@ for branch in "$BRANCH_NAME"; do
if [ ! -d .repo ]; then
echo ">> [$(date)] Initializing branch repository"
yes | repo init -q -u https://github.com/LineageOS/android.git --reference "$SRC_DIR/mirror/" -b "$branch"
yes | repo init -q -u https://github.com/LineageOS/android.git --reference "$MIRROR_DIR" -b "$branch"
fi
# Copy local manifests to the appropriate folder in order take them into consideration
@ -207,7 +206,7 @@ for branch in "$BRANCH_NAME"; do
# Sync the source code
echo ">> [$(date)] Syncing mirror repository"
builddate=$currentdate
cd "$SRC_DIR/mirror"
cd "$MIRROR_DIR"
repo sync -q --no-clone-bundle
echo ">> [$(date)] Syncing branch repository"
cd "$SRC_DIR/$branch_dir"