diff --git a/.taskcluster.yml b/.taskcluster.yml new file mode 100644 index 000000000..63a454560 --- /dev/null +++ b/.taskcluster.yml @@ -0,0 +1,32 @@ +version: 0 +tasks: + - provisionerId: '{{ taskcluster.docker.provisionerId }}' + workerType: '{{ taskcluster.docker.workerType }}' + extra: + github: + env: true + events: + - push + branches: + - auto + - master + - try + payload: + maxRunTime: 3600 + image: ubuntu@sha256:edf05697d8ea17028a69726b4b450ad48da8b29884cd640fec950c904bfb50ce + command: + - /usr/bin/env + - bash + - '--login' + - '-c' + - >- + git clone {{event.head.repo.url}} saltfs + && cd saltfs + && git config advice.detachedHead false + && git checkout {{event.head.sha}} + && ./etc/build_image.sh + metadata: + name: Servo Trusty OCI image builder + description: Build Trusty OCI images using Salt for building/testing Servo + owner: '{{ event.head.user.email }}' + source: '{{ event.head.repo.url }}' diff --git a/.travis.yml b/.travis.yml index 8ea29584f..67ba96368 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,16 +66,17 @@ matrix: - env: - SALT_NODE_ID=servo-linux1 - SALT_FROM_SCRATCH=true - # ubuntu/14.04 - - SALT_DOCKER_IMAGE=ubuntu@sha256:edf05697d8ea17028a69726b4b450ad48da8b29884cd640fec950c904bfb50ce + # ubuntu:trusty + # NOTE: Keep in sync with Dockerfile, .taskcluster.yml + - SALT_DOCKER_IMAGE=ubuntu@sha256:084989eb923bd86dbf7e706d464cf3587274a826b484f75b69468c19f8ae354c os: linux sudo: required dist: trusty - env: - SALT_NODE_ID=servo-linux1 - SALT_FROM_SCRATCH=true - # ubuntu/16.04 - - SALT_DOCKER_IMAGE=ubuntu@sha256:f3a61450ae43896c4332bda5e78b453f4a93179045f20c8181043b26b5e79028 + # ubuntu:xenial + - SALT_DOCKER_IMAGE=ubuntu@sha256:ec0e4e8bf2c1178e025099eed57c566959bb408c6b478c284c1683bc4298b683 os: linux sudo: required dist: trusty diff --git a/Dockerfile b/Dockerfile index 4ad7e5067..76a12488a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ -# Ubuntu Xenial -FROM ubuntu@sha256:a0ee7647e24c8494f1cf6b94f1a3cd127f423268293c25d924fbe18fd82db5a4 +# ubuntu:trusty +# NOTE: Keep in sync with .travis.yml +FROM ubuntu@sha256:084989eb923bd86dbf7e706d464cf3587274a826b484f75b69468c19f8ae354c ARG SALT_ROOT=/tmp/salt-bootstrap +ARG SALT_NODE_ID=servo-linux1 COPY ./ "${SALT_ROOT}" @@ -16,7 +18,6 @@ RUN : \ --id="${SALT_NODE_ID}" \ --config-dir="${SALT_ROOT}/.travis" \ --file-root="${SALT_ROOT}" \ - --log-level=warning \ --retcode-passthrough \ --force-color \ state.apply common,servo-build-dependencies \ diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 000000000..d77504f77 --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,31 @@ +# Docker usage + +## Overview + +As part of a move to [TaskCluster](https://docs.taskcluster.net/), +we are moving Linux builds from VMs +to [Docker](https://www.docker.com/) containers. +The Dockerfile in this repository will be used to create container images +that are suitable for running Servo builds. +To ease the transition, we will reuse our [Salt](https://saltstack.com/) +rules for provisioning in containers. + +In the future, the Dockerfile and supporting files will be moved into the main +Servo repository. +This will allow our decision task to rebuild our Docker +images when there are any changes, +to enable making builder configuration changes concurrently with code changes, +e.g. adding a new dependency. + +## Usage + +Docker images are automatically built by Taskcluster on pushes to master, +as well as when invoked by Homu by pushes to auto and try. + +To build manually, run from the saltfs root: +```sh +$ sudo docker build . +``` + +Currently, this creates an image capable only of building Servo itself, +not testing (no Xvfb) or cross-compiling (Android, ARM, etc.) yet. diff --git a/etc/build_image.sh b/etc/build_image.sh new file mode 100755 index 000000000..8a130ce89 --- /dev/null +++ b/etc/build_image.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +shopt -s nullglob + + +main() { + docker build \ + --force-rm=true \ + --no-cache=true \ + --compress=true \ + ./. +} + + +main "$@"