├── .buildkite ├── pipeline.yml └── template.yml ├── Dockerfile ├── License.md ├── Pipfile ├── Pipfile.lock ├── Readme.md ├── docker-compose.yml ├── renovate.json └── test_example.py /.buildkite/pipeline.yml: -------------------------------------------------------------------------------- 1 | 2 | steps: 3 | - name: ":python:" 4 | command: "py.test" 5 | plugins: 6 | - docker-compose#v5.2.0: 7 | run: app 8 | -------------------------------------------------------------------------------- /.buildkite/template.yml: -------------------------------------------------------------------------------- 1 | # Used by the 'Add to Buildkite' button in the readme 2 | name: "Python Docker Example" 3 | steps: 4 | - label: ":pipeline:" 5 | command: "buildkite-agent pipeline upload" 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python 2 | RUN pip install pipenv 3 | COPY . /app 4 | WORKDIR /app 5 | RUN pipenv install --deploy --dev 6 | ENV SHELL=/bin/bash 7 | ENTRYPOINT ["pipenv", "run"] 8 | CMD ["python"] -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Buildkite Pty Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | 3 | url = "https://pypi.python.org/simple" 4 | verify_ssl = true 5 | name = "pypi" 6 | 7 | 8 | [dev-packages] 9 | 10 | pytest = "*" 11 | 12 | [packages] -------------------------------------------------------------------------------- /Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "a28e60d6ec10434b5d5c40b6c3d799a45286fc0c6af7e2f5000aa77058933889" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": {}, 8 | "sources": [ 9 | { 10 | "name": "pypi", 11 | "url": "https://pypi.python.org/simple", 12 | "verify_ssl": true 13 | } 14 | ] 15 | }, 16 | "default": {}, 17 | "develop": { 18 | "attrs": { 19 | "hashes": [ 20 | "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836", 21 | "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99" 22 | ], 23 | "markers": "python_version >= '3.6'", 24 | "version": "==22.2.0" 25 | }, 26 | "iniconfig": { 27 | "hashes": [ 28 | "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", 29 | "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" 30 | ], 31 | "markers": "python_version >= '3.7'", 32 | "version": "==2.0.0" 33 | }, 34 | "packaging": { 35 | "hashes": [ 36 | "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2", 37 | "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97" 38 | ], 39 | "markers": "python_version >= '3.7'", 40 | "version": "==23.0" 41 | }, 42 | "pluggy": { 43 | "hashes": [ 44 | "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159", 45 | "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3" 46 | ], 47 | "markers": "python_version >= '3.6'", 48 | "version": "==1.0.0" 49 | }, 50 | "pytest": { 51 | "hashes": [ 52 | "sha256:27fa6617efc2869d3e969a3e75ec060375bfb28831ade8b5cdd68da3a741dc3c", 53 | "sha256:81a25f36a97da3313e1125fce9e7bbbba565bc7fec3c5beb14c262ddab238ac1" 54 | ], 55 | "index": "pypi", 56 | "version": "==7.2.0" 57 | }, 58 | "setuptools": { 59 | "hashes": [ 60 | "sha256:c3a9c4211ff4c309edb8b8c4f1cbfa7ae324c4ba9f91ff254e3d305b9fd54561", 61 | "sha256:fcc17fd9cd898242f6b4adfaca46137a9edef687f43e6f78469692a5e70d851d" 62 | ], 63 | "index": "pypi", 64 | "markers": "python_version >= '3.9'", 65 | "version": "==78.1.1" 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Buildkite Python Docker Example (using pipenv) 2 | 3 | [![Add to Buildkite](https://buildkite.com/button.svg)](https://buildkite.com/new) 4 | 5 | This repository is an example on how to test a [Python](https://python.org) project using [Buildkite](https://buildkite.com/), [Docker](https://www.docker.com/) and [pipenv](https://github.com/kennethreitz/pipenv). 6 | 7 | ## How does it work? 8 | 9 | * The [Dockerfile](Dockerfile) sets up the pipenv environment, and installs the dependencies 10 | * The [docker-compose.yml](docker-compose.yml) defines the 'app' Docker service and how it should be built 11 | * The [pipeline.yml](.buildkite/pipeline.yml) runs the command using Docker Compose 12 | 13 | ## License 14 | 15 | See [Licence.md](Licence.md) (MIT) -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | app: 5 | build: . -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /test_example.py: -------------------------------------------------------------------------------- 1 | def incr(x): 2 | return x + 1 3 | 4 | def test_incr(): 5 | assert incr(3) == 4 --------------------------------------------------------------------------------