2017-05-05 15:38:45 +02:00
|
|
|
FROM ubuntu:16.04
|
2017-05-03 17:32:18 +02:00
|
|
|
MAINTAINER Nicola Corna <nicola@corna.info>
|
2017-01-08 17:37:37 +01:00
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
#######################
|
|
|
|
|
|
|
|
ENV SRC_DIR /srv/src
|
|
|
|
ENV CCACHE_DIR /srv/ccache
|
2017-01-21 23:59:02 +01:00
|
|
|
ENV ZIP_DIR /srv/zips
|
2017-01-21 13:53:58 +01:00
|
|
|
ENV LMANIFEST_DIR /srv/local_manifests
|
2017-05-24 22:12:56 +02:00
|
|
|
ENV DELTA_DIR /srv/delta
|
|
|
|
ENV KEYS_DIR /srv/keys
|
2017-10-18 17:20:32 +02:00
|
|
|
ENV LOGS_DIR /srv/logs
|
2017-10-27 08:07:37 +02:00
|
|
|
ENV USERSCRIPTS_DIR /srv/userscripts
|
2017-08-07 16:54:08 +02:00
|
|
|
|
2017-05-05 15:38:45 +02:00
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
ENV USER root
|
2017-01-08 17:37:37 +01:00
|
|
|
|
|
|
|
# Configurable environment variables
|
|
|
|
####################################
|
|
|
|
|
|
|
|
# By default we want to use CCACHE, you can disable this
|
|
|
|
# WARNING: disabling this may slow down a lot your builds!
|
|
|
|
ENV USE_CCACHE 1
|
|
|
|
|
|
|
|
# Environment for the LineageOS Branch name
|
2017-01-08 22:18:21 +01:00
|
|
|
# See https://github.com/LineageOS/android_vendor_cm/branches for possible options
|
2017-01-08 17:37:37 +01:00
|
|
|
ENV BRANCH_NAME 'cm-14.1'
|
|
|
|
|
2017-07-30 18:13:55 +02:00
|
|
|
# Environment for the device list (separate by comma if more than one)
|
2017-01-08 17:37:37 +01:00
|
|
|
# eg. DEVICE_LIST=hammerhead,bullhead,angler
|
|
|
|
ENV DEVICE_LIST ''
|
|
|
|
|
2017-05-30 21:43:54 +02:00
|
|
|
# Release type string
|
|
|
|
ENV RELEASE_TYPE 'UNOFFICIAL'
|
|
|
|
|
2017-10-18 17:33:30 +02:00
|
|
|
# OTA build.prop key that will be used inside Updater/CMUpdater
|
|
|
|
# This should be set to 'cm.updater.uri. for LineageOS/Cyanogenmod <= 14.1 and
|
|
|
|
# to 'lineage.updater.uri' for LineageOS >= 15.0
|
|
|
|
ENV OTA_PROP 'cm.updater.uri'
|
|
|
|
|
2017-01-08 17:37:37 +01:00
|
|
|
# OTA URL that will be used inside CMUpdater
|
|
|
|
# Use this in combination with LineageOTA to make sure your device can auto-update itself from this buildbot
|
|
|
|
ENV OTA_URL ''
|
|
|
|
|
|
|
|
# User identity
|
|
|
|
ENV USER_NAME 'LineageOS Buildbot'
|
|
|
|
ENV USER_MAIL 'lineageos-buildbot@docker.host'
|
|
|
|
|
2017-07-30 18:13:55 +02:00
|
|
|
# If you want to start always fresh (re-download all the source code everytime) set this to 'true'
|
2017-01-08 17:37:37 +01:00
|
|
|
ENV CLEAN_SRCDIR false
|
|
|
|
|
|
|
|
# If you want to preserve old ZIPs set this to 'false'
|
2017-08-07 16:54:08 +02:00
|
|
|
ENV CLEAN_OUTDIR false
|
2017-01-08 17:37:37 +01:00
|
|
|
|
|
|
|
# Change this cron rule to what fits best for you
|
2017-05-04 14:51:19 +02:00
|
|
|
# Use 'now' to start the build immediately
|
2017-08-07 16:54:08 +02:00
|
|
|
# For example, '0 10 * * *' means 'Every day at 10:00 UTC'
|
|
|
|
ENV CRONTAB_TIME 'now'
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-01-17 19:35:03 +01:00
|
|
|
# Clean artifacts output after each build
|
|
|
|
ENV CLEAN_AFTER_BUILD true
|
|
|
|
|
2017-06-06 08:27:09 +02:00
|
|
|
# Provide root capabilities builtin inside the ROM (see http://lineageos.org/Update-and-Build-Prep/)
|
2017-08-07 16:54:08 +02:00
|
|
|
ENV WITH_SU false
|
2017-01-21 11:43:44 +01:00
|
|
|
|
2017-01-21 11:49:25 +01:00
|
|
|
# Provide a default JACK configuration in order to avoid out-of-memory issues
|
|
|
|
ENV ANDROID_JACK_VM_ARGS "-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
|
|
|
|
|
2017-05-03 17:32:18 +02:00
|
|
|
# Custom packages to be installed
|
|
|
|
ENV CUSTOM_PACKAGES ''
|
|
|
|
|
|
|
|
# Key path (from the root of the android source)
|
2017-05-24 22:12:56 +02:00
|
|
|
ENV SIGN_BUILDS false
|
2017-05-03 17:32:18 +02:00
|
|
|
|
2017-05-17 00:33:15 +02:00
|
|
|
# Move the resulting zips to $ZIP_DIR/$codename instead of $ZIP_DIR/
|
2017-08-07 16:54:08 +02:00
|
|
|
ENV ZIP_SUBDIR true
|
2017-05-17 00:33:15 +02:00
|
|
|
|
2017-10-18 17:20:32 +02:00
|
|
|
# Write the verbose logs to $LOGS_DIR/$codename instead of $LOGS_DIR/
|
|
|
|
ENV LOGS_SUBDIR true
|
|
|
|
|
2017-07-30 18:10:47 +02:00
|
|
|
# Apply the MicroG's signature spoofing patch
|
|
|
|
# Valid values are "no", "yes" (for the original MicroG's patch) and
|
|
|
|
# "restricted" (to grant the permission only to the system privileged apps).
|
|
|
|
#
|
|
|
|
# The original ("yes") patch allows user apps to gain the ability to spoof
|
|
|
|
# themselves as other apps, which can be a major security threat. Using the
|
|
|
|
# restricted patch and embedding the apps that requires it as system privileged
|
|
|
|
# apps is a much secure option. See the README.md ("Custom mode") for an
|
|
|
|
# example.
|
2017-05-22 10:03:05 +02:00
|
|
|
ENV SIGNATURE_SPOOFING "no"
|
|
|
|
|
2017-06-06 08:27:09 +02:00
|
|
|
# Generate delta files
|
2017-05-24 22:12:56 +02:00
|
|
|
ENV BUILD_DELTA false
|
|
|
|
|
2017-06-06 08:27:09 +02:00
|
|
|
# Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable)
|
|
|
|
ENV DELETE_OLD_ZIPS 0
|
|
|
|
|
|
|
|
# Delete old deltas in $DELTA_DIR, keep only the N latest one (0 to disable)
|
|
|
|
ENV DELETE_OLD_DELTAS 0
|
|
|
|
|
2017-10-18 17:20:32 +02:00
|
|
|
# Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable)
|
|
|
|
ENV DELETE_OLD_LOGS 0
|
|
|
|
|
2017-08-05 11:25:32 +02:00
|
|
|
# Create a JSON file that indexes the build zips at the end of the build process
|
|
|
|
# (for the updates in OpenDelta). The file will be created in $ZIP_DIR with the
|
|
|
|
# specified name; leave empty to skip it.
|
|
|
|
# Requires ZIP_SUBDIR.
|
|
|
|
ENV OPENDELTA_BUILDS_JSON ''
|
|
|
|
|
2017-10-27 08:07:37 +02:00
|
|
|
# You can optionally specify a USERSCRIPTS_DIR volume containing these scripts:
|
|
|
|
# * begin.sh, run at the very beginning
|
|
|
|
# * before.sh, run after the syncing and patching, before starting the builds
|
|
|
|
# * pre-build.sh, run before the build of every device
|
|
|
|
# * post-build.sh, run after the build of every device
|
|
|
|
# * end.sh, run at the very end
|
|
|
|
# Each script will be run in $SRC_DIR and must be owned and writeable only by
|
|
|
|
# root
|
|
|
|
|
2017-01-08 17:37:37 +01:00
|
|
|
# Create Volume entry points
|
|
|
|
############################
|
|
|
|
VOLUME $SRC_DIR
|
|
|
|
VOLUME $CCACHE_DIR
|
2017-01-21 23:59:02 +01:00
|
|
|
VOLUME $ZIP_DIR
|
2017-01-21 11:56:58 +01:00
|
|
|
VOLUME $LMANIFEST_DIR
|
2017-05-24 22:12:56 +02:00
|
|
|
VOLUME $DELTA_DIR
|
|
|
|
VOLUME $KEYS_DIR
|
2017-10-18 17:20:32 +02:00
|
|
|
VOLUME $LOGS_DIR
|
2017-10-27 08:07:37 +02:00
|
|
|
VOLUME $USERSCRIPTS_DIR
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-05-25 07:07:03 +02:00
|
|
|
# Copy required files
|
2017-01-08 17:37:37 +01:00
|
|
|
#####################
|
2017-07-30 18:10:47 +02:00
|
|
|
COPY src/ /root/
|
2017-01-08 17:37:37 +01:00
|
|
|
|
|
|
|
# Create missing directories
|
|
|
|
############################
|
|
|
|
RUN mkdir -p $SRC_DIR
|
|
|
|
RUN mkdir -p $CCACHE_DIR
|
2017-01-21 23:59:02 +01:00
|
|
|
RUN mkdir -p $ZIP_DIR
|
2017-01-21 11:56:58 +01:00
|
|
|
RUN mkdir -p $LMANIFEST_DIR
|
2017-05-24 22:12:56 +02:00
|
|
|
RUN mkdir -p $DELTA_DIR
|
|
|
|
RUN mkdir -p $KEYS_DIR
|
2017-10-18 17:20:32 +02:00
|
|
|
RUN mkdir -p $LOGS_DIR
|
2017-10-27 08:07:37 +02:00
|
|
|
RUN mkdir -p $USERSCRIPTS_DIR
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-05-05 15:38:45 +02:00
|
|
|
# Install build dependencies
|
|
|
|
############################
|
|
|
|
RUN apt-get -qq update
|
|
|
|
RUN apt-get -qqy upgrade
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-05-07 15:43:22 +02:00
|
|
|
RUN apt-get install -y bc bison build-essential ccache cron curl flex \
|
|
|
|
g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev \
|
2017-05-05 15:38:45 +02:00
|
|
|
lib32readline6-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev \
|
|
|
|
libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop \
|
2017-07-15 15:08:19 +02:00
|
|
|
openjdk-8-jdk pngcrush rsync schedtool squashfs-tools wget xdelta3 \
|
|
|
|
xsltproc zip zlib1g-dev
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-05-05 15:38:45 +02:00
|
|
|
RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
|
|
|
|
RUN chmod a+x /usr/local/bin/repo
|
2017-01-08 17:37:37 +01:00
|
|
|
|
2017-05-24 22:12:56 +02:00
|
|
|
# Download and build delta tools
|
|
|
|
################################
|
|
|
|
RUN cd /root/ && \
|
|
|
|
mkdir delta && \
|
2017-07-15 15:08:19 +02:00
|
|
|
git clone --depth=1 https://github.com/omnirom/android_packages_apps_OpenDelta.git OpenDelta && \
|
|
|
|
gcc -o delta/zipadjust OpenDelta/jni/zipadjust.c OpenDelta/jni/zipadjust_run.c -lz && \
|
|
|
|
cp OpenDelta/server/minsignapk.jar OpenDelta/server/opendelta.sh delta/ && \
|
|
|
|
chmod +x delta/opendelta.sh && \
|
|
|
|
rm -rf OpenDelta/ && \
|
|
|
|
sed -i -e 's|^\s*HOME=.*|HOME=/root|; \
|
|
|
|
s|^\s*BIN_XDELTA=.*|BIN_XDELTA=xdelta3|; \
|
|
|
|
s|^\s*FILE_MATCH=.*|FILE_MATCH=lineage-\*.zip|; \
|
|
|
|
s|^\s*PATH_CURRENT=.*|PATH_CURRENT=$SRC_DIR/out/target/product/$DEVICE|; \
|
|
|
|
s|^\s*PATH_LAST=.*|PATH_LAST=$SRC_DIR/delta_last/$DEVICE|; \
|
|
|
|
s|^\s*KEY_X509=.*|KEY_X509=$KEYS_DIR/releasekey.x509.pem|; \
|
|
|
|
s|^\s*KEY_PK8=.*|KEY_PK8=$KEYS_DIR/releasekey.pk8|; \
|
|
|
|
s|publish|$DELTA_DIR|g' /root/delta/opendelta.sh
|
2017-05-24 22:12:56 +02:00
|
|
|
|
|
|
|
# Set the work directory
|
|
|
|
########################
|
|
|
|
WORKDIR $SRC_DIR
|
|
|
|
|
2017-01-15 23:03:17 +01:00
|
|
|
# Allow redirection of stdout to docker logs
|
|
|
|
############################################
|
2017-05-05 15:38:45 +02:00
|
|
|
RUN ln -sf /proc/1/fd/1 /var/log/docker.log
|
2017-01-08 17:37:37 +01:00
|
|
|
|
|
|
|
# Set the entry point to init.sh
|
2017-08-07 16:54:08 +02:00
|
|
|
################################
|
2017-05-03 17:32:18 +02:00
|
|
|
ENTRYPOINT /root/init.sh
|