Add Docker for easy usage#329
Conversation
Remove Python 3.2, 3.3. Load dependencies from requirements.txt.
Wait until we download and install Prism to start running it.
Nothing says your virtualenv is under venv/ or that you're using one at all.
Everything but python 2.6 uses unittest discover, so might as well make it easy to change.
See gabrielkrell/sendgrid-python-docker for commit history. Dockerfile downloads python versions, Prism, tox, default (latest at build time) SendGrid libs. Maintains symlinks for easy use.
Add SendGrid footer, headers. Clean up examples, add actual code.
Be more clear about how to use old versions.
568cca7 to
cc7ab1b
Compare
Graphical tweaks, mostly. Single space after sentences.
89e97cc to
605d27d
Compare
Turns out GitHub's syntax highlighting for bash sessions sucks, though. They pull from a documented repo, so one to-do is contribute to this in personal time.
| @@ -0,0 +1,42 @@ | |||
| FROM ubuntu:latest | |||
There was a problem hiding this comment.
Maybe we should pin this to a particular version so that we have a specific working configuration.
There was a problem hiding this comment.
ubuntu:latest points to the latest LTS release (16.04 right now). I wanted to avoid forgetting about it later on and having an old version, but I guess it's worth the trouble to avoid a possible break when we're not expecting it.
| RUN ln -s /root/sources/sendgrid-python/sendgrid && \ | ||
| ln -s /root/sources/python-http-client/python_http_client | ||
|
|
||
| COPY entrypoint.sh entrypoint.sh |
There was a problem hiding this comment.
This looks like it's copying to the same directory.
There was a problem hiding this comment.
Using COPY as an alternative to ADD; apparently it's best-practice. It copies entrypoint.sh from the directory the Dockerfile is in into /root (set with WORKDIR earlier) and runs from there later on. The final directory structure looks like this:
/root
entrypoint.sh
sendgrid
python_http_client
/sources
/python-http-client
README.md
/python_http_client
...
/sendgrid-python
README.md
/sendgrid
...
| - `sendgrid-python` and `python-http-client` | ||
| - Stoplight's Prism, which lets you try out the API without actually sending email | ||
| - A complete setup for testing the repository or your own fork | ||
|
|
There was a problem hiding this comment.
We should mention the various version of Python that are installed.
There was a problem hiding this comment.
It's a little unwieldy to mention the specific versions (especially as this can change); I'll mention details of the setup here and save individual versions for running the container.
| $ docker run -it sendgrid/sendgrid-python:v3.6.1 | ||
| ``` | ||
|
|
||
| Tags from before this Docker image was created might not exist yet. You may [manually download](#Versions) old versions in order to use them. |
There was a problem hiding this comment.
We should link them to the release tags: https://github.com/sendgrid/sendgrid-python/releases
| fi | ||
|
|
||
| SENDGRID_PYTHON_VERSION=$(python2.7 -c 'import sendgrid; print(sendgrid.__version__)') | ||
| echo "Welcome to the sendgrid-python docker (version $SENDGRID_PYTHON_VERSION)" |
There was a problem hiding this comment.
You can remove "the" here.
|
|
||
| if [ "$1" != "--no-mock" ] | ||
| then | ||
| echo "Starting Prism in mock mode. Disable this by running this container with --no-mock." |
There was a problem hiding this comment.
We don't say what mock mode means.
There was a problem hiding this comment.
Ah, I see you reference it as passthrough mode later. We should be consistent and say mock/no-mock or something similar.
| echo "To stop Prism, run \"kill $!\" from the shell." | ||
|
|
||
| echo | ||
| echo "Starting python. Type \"import sendgrid\" to get started; return to shell with exit()." |
There was a problem hiding this comment.
Python should be capitalized here.
Dockerfile - Pin to specific Ubuntu Readme: - Mention preinstalled Pythons - Link to releases page Entrypoint: - Tidy welcome text - Explain mock/no-mock mode - Remove "passthrough" - Tidy exit text
|
Thanks Elmer! I'll ping you once the Docker Hub thing is set up and this is ready to go. |
New README.md because it shows up in Docker Hub. Moved old contents to USAGE.md.
Consistency with other readmes
Linking to the Docker Hub page for now, even though USAGE.md is better.
46e4d55 to
4b557ca
Compare
Add docker hype to readme preheader, "dev env" section of contributing.
Add a Docker container to make it easier to try out or contribute to sendgrid-python.
tox.iniNote: Don't approve until sendgrid/python Docker Hub has been created + linked. Also, should probably be squashed based on # of tiny commits.