From 0e48c1f57563af4afe51639e7e8eac665a3a1375 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 2 Mar 2019 21:43:13 +0000 Subject: [PATCH] add docker travis deploy --- .gitignore | 1 + .travis.yml | 19 +++++++++++++++++-- Dockerfile | 7 +++++++ Makefile | 12 +++++++++++- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/.gitignore b/.gitignore index 9a3f45b6..ada6bc84 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ build/ dist/ snapcraft.yaml tqdm_*_amd64.snap +.dockerignore # Unit test / coverage reports .tox/ diff --git a/.travis.yml b/.travis.yml index 4612c8cd..18336d53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,17 @@ matrix: - python: 3.6 env: TOXENV=py36 - python: 3.7 - dist: xenial - sudo: true # required for py37 env: TOXENV=py37 + dist: xenial + sudo: true # required for py37, docker + services: + - docker before_deploy: + - echo "$DOCKER_PWD" | docker login -u $DOCKER_USR --password-stdin + - make -B docker + - | + if [[ -n "$TRAVIS_TAG" ]]; then + docker tag tqdm/tqdm:latest tqdm/tqdm:$TRAVIS_TAG ; fi - pip install .[dev] - make build #- make submodules @@ -39,6 +46,14 @@ matrix: name: tqdm v$TRAVIS_TAG stable on: tags: true + - provider: script + script: docker push tqdm/tqdm:latest + on: + tags: true + - provider: script + script: docker push tqdm/tqdm:$TRAVIS_TAG + on: + tags: true - python: pypy2.7-5.10.0 env: TOXENV=pypy - python: pypy3.5-5.10.0 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d7e65156 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.7-alpine +COPY setup.py tqdm/ +COPY requirements-dev.txt tqdm/ +COPY README.rst tqdm/ +COPY tqdm tqdm/tqdm +RUN pip install -U ./tqdm +ENTRYPOINT ["tqdm"] diff --git a/Makefile b/Makefile index 01c053da..199b0ca6 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ buildupload pypi snap + docker help none @@ -99,6 +100,11 @@ snapcraft.yaml: .snapcraft.yml -e 's/{source}/./g' -e 's/{icon}/logo.png/g' \ -e 's/{description}/https:\/\/tqdm.github.io/g' > "$@" +.dockerignore: .gitignore + cat $^ > "$@" + echo -e ".git" > "$@" + git clean -xdn | sed -nr 's/^Would remove (.*)$$/\1/p' >> "$@" + distclean: @+make coverclean @+make prebuildclean @@ -148,6 +154,10 @@ buildupload: snap: @make snapcraft.yaml snapcraft - +docker: + @make .dockerignore + @make coverclean + @make clean + docker build . -t tqdm/tqdm none: # used for unit testing