From 66c92f90fd420aa8ee5195583c9c4072524d2347 Mon Sep 17 00:00:00 2001 From: Jonatas Baldin Date: Mon, 18 Jun 2018 18:26:58 +0200 Subject: [PATCH 1/3] Add Dockerfile and related changes to build the Docker image --- .travis.yml | 5 +++++ Dockerfile | 13 +++++++++++++ Makefile | 11 +++++++++++ 3 files changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/.travis.yml b/.travis.yml index a4d9a6faea..d8aeeaee73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,3 +10,8 @@ install: - make test-install script: - make test +deploy: + script: + - make docker-build + - make docker-push + on: tags diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..1e254dfdb4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.6 + +ENV PYTHONUNBUFFERED 1 + +RUN mkdir -p /twilio/twilio +WORKDIR /twilio + +COPY setup.py . +COPY requirements.txt . +COPY README.rst . +COPY twilio/ twilio/ + +RUN pip install . diff --git a/Makefile b/Makefile index 69dd2a8297..25d48a8fd9 100644 --- a/Makefile +++ b/Makefile @@ -45,3 +45,14 @@ clean: nopyc: find . -name \*.pyc -delete + +API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5) +docker-build: + docker build -t twilio/twilio-python . + docker tag twilio/twilio-python twilio/twilio-python:${TRAVIS_TAG} + docker tag twilio/twilio-python twilio/twilio-python:${API_DEFINITIONS_SHA} + +docker-push: + docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} + docker push twilio/twilio-python:${TRAVIS_TAG} + docker push twilio/twilio-python:${API_DEFINITIONS_TAG} From acb94afc47c1d5ff17e9590c135e9adf8f3a1d19 Mon Sep 17 00:00:00 2001 From: Jonatas Baldin Date: Tue, 19 Jun 2018 15:02:39 +0200 Subject: [PATCH 2/3] Simplify folder structure --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e254dfdb4..6ec70d89d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM python:3.6 ENV PYTHONUNBUFFERED 1 -RUN mkdir -p /twilio/twilio +RUN mkdir /twilio WORKDIR /twilio COPY setup.py . COPY requirements.txt . COPY README.rst . -COPY twilio/ twilio/ +COPY twilio ./twilio RUN pip install . From 114e404d3c271f1ac4d977163834b11524af0f36 Mon Sep 17 00:00:00 2001 From: Jonatas Baldin Date: Thu, 21 Jun 2018 20:18:09 +0200 Subject: [PATCH 3/3] Add README section about Dockerfile and correct api definitions tag --- Makefile | 4 ++-- README.rst | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 25d48a8fd9..0dbfecd76e 100644 --- a/Makefile +++ b/Makefile @@ -50,9 +50,9 @@ API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cu docker-build: docker build -t twilio/twilio-python . docker tag twilio/twilio-python twilio/twilio-python:${TRAVIS_TAG} - docker tag twilio/twilio-python twilio/twilio-python:${API_DEFINITIONS_SHA} + docker tag twilio/twilio-python twilio/twilio-python:apidefs-${API_DEFINITIONS_SHA} docker-push: docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} docker push twilio/twilio-python:${TRAVIS_TAG} - docker push twilio/twilio-python:${API_DEFINITIONS_TAG} + docker push twilio/twilio-python:apidefs-${API_DEFINITIONS_TAG} diff --git a/README.rst b/README.rst index 988b9d3e5a..b5322a61e6 100644 --- a/README.rst +++ b/README.rst @@ -154,3 +154,8 @@ To control phone calls, your application needs to output Welcome to twilio! + +Docker Image +~~~~~~~~~~~~ + +The `Dockerfile` present in this repository and its respective `twilio/twilio-python` Docker image are currently used by Twilio for testing purposes only.