Merge pull request #532 from sbrunner/docker-deploy

Proposal to deploy Docker image on each commit on master
This commit is contained in:
ahyear 2019-04-25 14:52:03 +02:00 committed by GitHub
commit 351809b8a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View File

@ -12,7 +12,11 @@ matrix:
- python: "3.5"
- python: "3.6"
- python: "3.7-dev"
- env: BUILD_DOCKER=1
- env:
- BUILD_DOCKER=1
# Variable to add to publish the Docker image:
# * DOCKER_USERNAME
# * DOCKER_PASSWORD, to be encrypted, use `travis encrypt DOCKER_PASSWORD=<password>`
services:
- docker
before_install:
@ -20,7 +24,7 @@ matrix:
install:
- true
script:
- docker build -t paperless .
- docker build --tag=the-paperless-project/paperless .
after_success:
- true
@ -37,3 +41,17 @@ script:
after_success:
- coveralls
deploy:
- provider: script
skip_cleanup: true
script: ci/deploy-docker
on:
tags: true
condition: '"${BUILD_DOCKER}" = 1'
- provider: script
skip_cleanup: true
script: ci/deploy-docker
on:
branch: master
condition: '"${BUILD_DOCKER}" = 1'

15
ci/deploy-docker Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ "${DOCKER_USERNAME}" == "" -o "${DOCKER_PASSWORD}" == "" ]
then
exit 0
fi
docker login --username=${DOCKER_USERNAME} --password=${DOCKER_PASSWORD}
if [ "${TRAVIS_TAG}" != "" ]
then
docker tag the-paperless-project/paperless the-paperless-project/paperless:${TRAVIS_TAG}
docker push the-paperless-project/paperless:${TRAVIS_TAG}
else
docker push the-paperless-project/paperless
fi