Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Dockerfile.community 6.65 KiB
Newer Older
Romain Hunault's avatar
Romain Hunault committed
FROM ubuntu:20.04
Romain Hunault's avatar
Romain Hunault committed
MAINTAINER Romain Hunault <romain.hunault@e.email>

# Environment variables
#######################

ENV MIRROR_DIR /srv/mirror
ENV SRC_DIR /srv/src
ENV TMP_DIR /srv/tmp
ENV CCACHE_DIR /srv/ccache
ENV ZIP_DIR /srv/zips
ENV LMANIFEST_DIR /srv/local_manifests
ENV KEYS_DIR /srv/keys
ENV LOGS_DIR /srv/logs
ENV USERSCRIPTS_DIR /srv/userscripts

ENV DEBIAN_FRONTEND noninteractive
ENV USER root

# 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

# ccache maximum size. It should be a number followed by an optional suffix: k,
# M, G, T (decimal), Ki, Mi, Gi or Ti (binary). The default suffix is G. Use 0
# for no limit.
ENV CCACHE_SIZE 50G

Romain Hunault's avatar
Romain Hunault committed
# We need to specify the ccache binary since it is no longer packaged along with AOSP
ENV CCACHE_EXEC /usr/bin/ccache

Romain Hunault's avatar
Romain Hunault committed
# Environment for the /e/ branches name
# See https://github.com/LineageOS/android_vendor_cm/branches for possible options
Romain Hunault's avatar
Romain Hunault committed
ENV BRANCH_NAME 'v1-q'
Romain Hunault's avatar
Romain Hunault committed

# Environment for the device list (separate by comma if more than one)
# eg. DEVICE_LIST=hammerhead,bullhead,angler
ENV DEVICE_LIST ''

# Release type string
ENV RELEASE_TYPE 'UNOFFICIAL'

# Repo use for build
ENV REPO 'https://gitlab.e.foundation/e/os/android.git'

# Repo use for build
ENV MIRROR 'https://github.com/LineageOS/mirror'

# 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'

Romain Hunault's avatar
Romain Hunault committed
# Include proprietary files, downloaded automatically from github.com/TheMuppets/ and gitlab.com/the-muppets/
Romain Hunault's avatar
Romain Hunault committed
# Only some branches are supported
ENV INCLUDE_PROPRIETARY true

# Mount an overlay filesystem over the source dir to do each build on a clean source
ENV BUILD_OVERLAY false

# Clone the full LineageOS mirror (> 200 GB)
ENV LOCAL_MIRROR false

# If you want to preserve old ZIPs set this to 'false'
ENV CLEAN_OUTDIR false

# Change this cron rule to what fits best for you
# Use 'now' to start the build immediately
# For example, '0 10 * * *' means 'Every day at 10:00 UTC'
ENV CRONTAB_TIME 'now'

# Clean artifacts output after each build
ENV CLEAN_AFTER_BUILD true

# Provide root capabilities builtin inside the ROM (see http://lineageos.org/Update-and-Build-Prep/)
ENV WITH_SU false

# 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"

# Custom packages to be installed
ENV CUSTOM_PACKAGES ''

# Sign the builds with the keys in $KEYS_DIR
ENV SIGN_BUILDS false

# When SIGN_BUILDS = true but no keys have been provided, generate a new set with this subject
ENV KEYS_SUBJECT '/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'

# Move the resulting zips to $ZIP_DIR/$codename instead of $ZIP_DIR/
ENV ZIP_SUBDIR true

# Write the verbose logs to $LOGS_DIR/$codename instead of $LOGS_DIR/
ENV LOGS_SUBDIR true

# Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable)
ENV DELETE_OLD_ZIPS 0

# Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable)
ENV DELETE_OLD_LOGS 0

# Assume device does not use vendor_boot as recovery by default
ENV VBOOT_IS_RECOVERY false

# Assume device does not need additional files for recovery to boot.
ENV RECOVERY_NEEDS_SUPPORT_IMG false

# Assume device does not use vendor_boot for recovery to boot by default.
ENV RECOVERY_NEEDS_VENDOR_BOOT_IMG false

# Assume device does not use boot.img for recovery to boot by default.
ENV RECOVERY_NEEDS_BOOT_IMG false

# Assume device does not use DTBO for recovery to boot by default.
ENV RECOVERY_NEEDS_DTBO_IMG false

# Assume device does not use VBMETA for recovery to boot by default.
ENV RECOVERY_NEEDS_VBMETA_IMG false

# Assume device does not use super_image for recovery to boot by default.
ENV RECOVERY_NEEDS_SUPER_IMG false

# Assume device does not use vendor_kernel_boot for recovery to boot by default.
ENV RECOVERY_NEEDS_VENDOR_KERNEL_BOOT_IMG false

Alexandre Roux's avatar
Alexandre Roux committed
# Force an eng build even when device name doesn't contain -eng
ENV ENG_BUILD false


Romain Hunault's avatar
Romain Hunault committed
# 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

# Create Volume entry points
############################
VOLUME $MIRROR_DIR
VOLUME $SRC_DIR
VOLUME $TMP_DIR
VOLUME $CCACHE_DIR
VOLUME $ZIP_DIR
VOLUME $LMANIFEST_DIR
VOLUME $KEYS_DIR
VOLUME $LOGS_DIR
VOLUME $USERSCRIPTS_DIR
VOLUME /root/.ssh

# Copy required files
#####################
COPY src/ /root/
COPY build-community.sh /root/build.sh
Romain Hunault's avatar
Romain Hunault committed

# Create missing directories
############################
RUN mkdir -p $MIRROR_DIR
RUN mkdir -p $SRC_DIR
RUN mkdir -p $TMP_DIR
RUN mkdir -p $CCACHE_DIR
RUN mkdir -p $ZIP_DIR
RUN mkdir -p $LMANIFEST_DIR
RUN mkdir -p $KEYS_DIR
RUN mkdir -p $LOGS_DIR
RUN mkdir -p $USERSCRIPTS_DIR

# Install build dependencies
############################
RUN apt-get -qq update
RUN apt-get -qqy upgrade

Romain Hunault's avatar
Romain Hunault committed
RUN apt-get install -y bc bison bsdmainutils build-essential ccache cgpt clang cron \
      curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick kmod jq \
Romain Hunault's avatar
Romain Hunault committed
      lib32ncurses5-dev libncurses5 lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool \
Romain Hunault's avatar
Romain Hunault committed
      libncurses5-dev libsdl1.2-dev libssl-dev libxml2 \
Romain Hunault's avatar
Romain Hunault committed
      libxml2-utils lsof lzop maven pngcrush \
tcecyk's avatar
tcecyk committed
      procps python python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc xxd yasm \
Romain Hunault's avatar
Romain Hunault committed
      zip zlib1g-dev

RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
RUN chmod a+x /usr/local/bin/repo
RUN ln -fs /usr/bin/python3 /usr/bin/python

# Use adoptopenjdk.net to be able to use OpeJDK8 on debian:buster
RUN curl -q https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
RUN add-apt-repository --yes https://packages.adoptium.net/artifactory/deb
RUN apt-get -qq update && apt-get install -y temurin-8-jdk
RUN update-alternatives --set java /usr/lib/jvm/temurin-8-jdk-amd64/bin/java
Romain Hunault's avatar
Romain Hunault committed

# Set the work directory
########################
WORKDIR $SRC_DIR

# Allow redirection of stdout to docker logs
############################################
RUN ln -sf /proc/1/fd/1 /var/log/docker.log

# Set the entry point to init.sh
################################
ENTRYPOINT /root/init.sh