Ken J Ken J - 2 months ago 14
Git Question

Travis Build Multiple Docker Images from a Single Repo

I'm trying to build Docker for multiple architectures. My repo is here:

https://github.com/mastermindg/docker-flow-proxy

I've created two Dockerfiles (amd64 and armv7). I've included the additional code into the .travis.yml.

How do I build both Docker images with a single travis yaml?

Answer

Use a build matrix to build:

env:
  global:
    - VERSION=1.${TRAVIS_BUILD_NUMBER}
  matrix:
    - ARCH=x86_64
      GOIMG=golang:1.6
      DOCKER_BUILD=mastermindg/docker-flow-proxy:${VERSION}
      DOCKERFILE=Dockerfile.amd64
    - ARCH=rpi
      GOIMG=kutsudock/rpi-alpine-go
      DOCKER_BUILD=mastermindg/docker-flow-proxy:rpi-${VERSION}
      DOCKERFILE=Dockerfile.rpi

sudo: required

services:
  - docker
.................
Comments