Skip to content

Commit 9d94522

Browse files
author
Matt Bernier
authored
Merge pull request #50 from NdagiStanley/master
Add docker files and update README
2 parents 5e6e4ff + 3b8cf53 commit 9d94522

File tree

5 files changed

+132
-0
lines changed

5 files changed

+132
-0
lines changed

.dockerignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
48+
# Translations
49+
*.mo
50+
*.pot
51+
52+
# Django stuff:
53+
*.log
54+
55+
# Sphinx documentation
56+
docs/_build/
57+
58+
# PyBuilder
59+
target/
60+
61+
#Ipython Notebook
62+
.ipynb_checkpoints
63+
64+
.env
65+
venv/
66+
.python-version
67+
cleanup.sh
68+
*_example.py
69+
.idea
70+
README.txt

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM ubuntu:xenial
2+
ENV PYTHON_VERSIONS='python2.6 python2.7 python3.4 python3.5 python3.6' \
3+
OAI_SPEC_URL="https://raw.githubusercontent.com/sendgrid/sendgrid-oai/master/oai_stoplight.json"
4+
5+
# install testing versions of python, including old versions, from deadsnakes
6+
RUN set -x \
7+
&& apt-get update \
8+
&& apt-get install -y --no-install-recommends software-properties-common \
9+
&& apt-add-repository -y ppa:fkrull/deadsnakes \
10+
&& apt-get update \
11+
&& apt-get install -y --no-install-recommends $PYTHON_VERSIONS \
12+
git \
13+
curl \
14+
&& apt-get purge -y --auto-remove software-properties-common \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
WORKDIR /root
18+
19+
# install Prism
20+
ADD https://raw.githubusercontent.com/stoplightio/prism/master/install.sh install.sh
21+
RUN chmod +x ./install.sh && \
22+
./install.sh && \
23+
rm ./install.sh
24+
25+
# install pip, tox
26+
ADD https://bootstrap.pypa.io/get-pip.py get-pip.py
27+
RUN python2.7 get-pip.py && \
28+
pip install tox && \
29+
rm get-pip.py
30+
31+
# set up default sendgrid env
32+
WORKDIR /root/sources
33+
RUN git clone https://github.com/sendgrid/sendgrid-python.git && \
34+
git clone https://github.com/sendgrid/python-http-client.git
35+
WORKDIR /root
36+
RUN ln -s /root/sources/sendgrid-python/sendgrid && \
37+
ln -s /root/sources/python-http-client/python_http_client
38+
39+
COPY . .
40+
CMD sh run.sh

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ If you are looking for the SendGrid API client library, please see [this repo](h
1919
* [Usage](#usage)
2020
* [Roadmap](#roadmap)
2121
* [How to Contribute](#contribute)
22+
- [Local set up](#local_setup)
2223
* [Troubleshooting](#troubleshooting)
2324
* [Announcements](#announcements)
2425
* [Thanks](#thanks)
@@ -100,6 +101,18 @@ Quick links:
100101
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#cla)
101102
- [Improvements to the Codebase](https://github.com/sendgrid/python-http-client/blob/master/CONTRIBUTING.md#improvements-to-the-codebase)
102103

104+
<a name="local_setup"></a>
105+
106+
# Local Setup of the project
107+
108+
The simplest local development workflow is by using docker.
109+
110+
> Steps
111+
112+
1. Install Docker
113+
2. Run `docker-compose build` (This builds the container)
114+
3. Run `docker-compose up` (This runs tests by default)
115+
103116
<a name="troubleshooting"></a>
104117
# Troubleshooting
105118

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3'
2+
services:
3+
app:
4+
build: .
5+
volumes:
6+
- .:/root

run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
python2.7 -m unittest discover -v

0 commit comments

Comments
 (0)