Skip to content

Instantly share code, notes, and snippets.

@SpencerMalone
Created June 24, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpencerMalone/6f764a101c9ffd4a86829f158eef9d41 to your computer and use it in GitHub Desktop.
Save SpencerMalone/6f764a101c9ffd4a86829f158eef9d41 to your computer and use it in GitHub Desktop.
Headless Ozone Chrome Builder. Results in very large unclean image (18.6 gb)
FROM ubuntu:16.04
# Install Chromium build dependencies.
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty multiverse" >> /etc/apt/sources.list # && dpkg --add-architecture i386
RUN apt-get update && apt-get install -qy git build-essential clang curl
RUN curl -L https://gist.githubusercontent.com/SpencerMalone/2345d216e61f4ddf9d54c5250af37a0f/raw/42fd576fc1ad2ed5b2748c20d67d471881516ac2/install-build-deps.sh > /tmp/install-build-deps.sh
RUN apt-get update && apt-get install -qy lsb-release sudo locales
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections
RUN chmod +x /tmp/install-build-deps.sh
RUN /tmp/install-build-deps.sh --no-prompt --no-arm --no-chromeos-fonts --no-nacl
RUN rm /tmp/install-build-deps.sh
# Don't build as root.
RUN useradd -m user
USER user
ENV HOME /home/user
WORKDIR /home/user
# Install Chromium's depot_tools.
ENV DEPOT_TOOLS /home/user/depot_tools
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS
ENV PATH $PATH:$DEPOT_TOOLS
RUN echo -e "\n# Add Chromium's depot_tools to the PATH." >> .bashrc
RUN echo "export PATH=\"\$PATH:$DEPOT_TOOLS\"" >> .bashrc
# Download Chromium sources.
RUN fetch --nohooks --no-history chromium --nosvn=True
RUN gclient runhooks
USER root
RUN apt-get install -yq vim
USER user
WORKDIR src
RUN mkdir -p out/HeadlessOzone && echo "use_ozone = true" > out/HeadlessOzone/args.gn && echo "enable_package_mash_services = true" >> out/HeadlessOzone/args.gn && echo "enable_nacl = false" >> out/HeadlessOzone/args.gn && echo "symbol_level=0" >> out/HeadlessOzone/args.gn && echo "remove_webcore_debug_symbols=true" >> out/HeadlessOzone/args.gn && gn gen out/HeadlessOzone
RUN ninja -C out/HeadlessOzone chrome
RUN ninja -C out/HeadlessOzone chromedriver
# Output files are located at...
# /home/user/src/out/HeadlessOzone/chrome
# /home/user/src/out/HeadlessOzone/chromedriver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment