From b2e01e6e06be727bc959e04c438915e184dd6bbb Mon Sep 17 00:00:00 2001 From: Stanley Ndagi Date: Fri, 27 Oct 2017 17:32:20 +0300 Subject: [PATCH 1/2] Add docker files and update README --- .dockerignore | 70 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 40 ++++++++++++++++++++++++++ README.md | 12 ++++++++ docker-compose.yml | 6 ++++ run.sh | 3 ++ 5 files changed, 131 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 run.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0487142 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,70 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints + +.env +venv/ +.python-version +cleanup.sh +*_example.py +.idea +README.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8f5a44f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:xenial +ENV PYTHON_VERSIONS='python2.6 python2.7 python3.4 python3.5 python3.6' \ + OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json" + +# install testing versions of python, including old versions, from deadsnakes +RUN set -x \ + && apt-get update \ + && apt-get install -y --no-install-recommends software-properties-common \ + && apt-add-repository -y ppa:fkrull/deadsnakes \ + && apt-get update \ + && apt-get install -y --no-install-recommends $PYTHON_VERSIONS \ + git \ + curl \ + && apt-get purge -y --auto-remove software-properties-common \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /root + +# install Prism +ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh +RUN chmod +x ./install.sh && \ + ./install.sh && \ + rm ./install.sh + +# install pip, tox +ADD https://bootstrap.pypa.io/get-pip.py get-pip.py +RUN python2.7 get-pip.py && \ + pip install tox && \ + rm get-pip.py + +# set up default sendgrid env +WORKDIR /root/sources +RUN git clone https://github.com/sendgrid/sendgrid-python.git && \ + git clone https://github.com/sendgrid/python-http-client.git +WORKDIR /root +RUN ln -s /root/sources/sendgrid-python/sendgrid && \ + ln -s /root/sources/python-http-client/python_http_client + +COPY . . +CMD sh run.sh diff --git a/README.md b/README.md index ba9c9a6..d692fa7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ If you are looking for the SendGrid API client library, please see [this repo](h * [Usage](#usage) * [Roadmap](#roadmap) * [How to Contribute](#contribute) +- [Local set up](#local_setup) * [Troubleshooting](#troubleshooting) * [Announcements](#announcements) * [Thanks](#thanks) @@ -100,6 +101,17 @@ Quick links: - [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#cla) - [Improvements to the Codebase](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase) + + +# Local Setup of the project + +The simplest local development workflow is by using docker. + +> Steps + +1. Install Docker +2. Run `docker-compose up` (This runs tests by default) + # Troubleshooting diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1b05a3c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3' +services: + app: + build: . + volumes: + - .:/root diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..4c45a10 --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +python2.7 -m unittest discover -v From 23d8a0f6ad4ef0308800300101146befe9880f2f Mon Sep 17 00:00:00 2001 From: mbernier Date: Sat, 28 Oct 2017 22:14:04 -0600 Subject: [PATCH 2/2] added docker build --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d692fa7..2376003 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,8 @@ The simplest local development workflow is by using docker. > Steps 1. Install Docker -2. Run `docker-compose up` (This runs tests by default) +2. Run `docker-compose build` (This builds the container) +3. Run `docker-compose up` (This runs tests by default) # Troubleshooting