Skip to content

Commit

Permalink
Travis to deploy multi-arch docker build. Attempt #1
Browse files Browse the repository at this point in the history
  • Loading branch information
yozik04 committed Nov 26, 2019
1 parent 4710363 commit 08ee6a3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
language: python
sudo: required
dist: xenial
language: python
python:
- '3.5'
- '3.6'
- '3.7'
- '3.5'
- '3.6'
- '3.7'
install:
- pip install .
- pip install -r requirements.txt
script: python setup.py test
- pip install .
- pip install -r requirements.txt
script: python setup.py test
deploy:
provider: script
script: ./.travis/deploy.sh
if: type != pull_request
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^(dev)$
addons:
apt:
sources:
- sourceline: 'deb https://download.docker.com/linux/ubuntu/ xenial stable'
key_url: 'https://download.docker.com/linux/ubuntu/gpg'
packages:
- docker-ce
- docker-ce-cli
- containerd.io
language: python
python: '3.6'
script: ./.travis/deploy.sh
10 changes: 10 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e
export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
export DOCKER_IMAGE_TAG=$(if [ "$BRANCH" == "master" ]; then echo "latest"; else echo "$BRANCH-latest"; fi)
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --use
docker buildx build --progress plain --platform linux/amd64,linux/arm64,linux/arm/v7 -t $DOCKER_USERNAME/pai:$DOCKER_IMAGE_TAG . --push

0 comments on commit 08ee6a3

Please sign in to comment.