Skip to content

Commit

Permalink
🚚 Refactor build setup (#14)
Browse files Browse the repository at this point in the history
* ➕ Move to Poetry from Pipenv

* 🚚 Centralize and reuse config and files

* 🔧 Update configs and scripts

* 👷 Add GitHub Actions for CI

* 🔥 Disable Travis

* 🔧 Add mypy configs

* ✅ Update tests to use new setup

* 📝 Update README
  • Loading branch information
tiangolo authored May 4, 2020
1 parent 7125232 commit 9157f88
Show file tree
Hide file tree
Showing 103 changed files with 355 additions and 700 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy

on:
push:
branches:
- master

jobs:
build:
strategy:
matrix:
image:
- name: latest
python_version: "3.7"
- name: python3.7
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- name: python2.7
python_version: "2.7"
- name: python3.7-alpine3.8
python_version: "3.7"
- name: python3.6-alpine3.8
python_version: "3.6"
fail-fast: true
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Install Dependencies
run: python3.7 -m pip install docker pytest
- name: Deploy Image
run: bash scripts/build-push.sh
env:
NAME: ${{ matrix.image.name }}
DOCKERFILE: ${{ matrix.image.dockerfile }}
PYTHON_VERSION: ${{ matrix.image.python_version }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
21 changes: 21 additions & 0 deletions .github/workflows/issue-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Issue Manager

on:
schedule:
- cron: "0 0 * * *"

jobs:
issue-manager:
runs-on: ubuntu-latest
steps:
- uses: tiangolo/issue-manager@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
config: >
{
"answered": {
"users": ["tiangolo"],
"delay": 864000,
"message": "Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues."
}
}
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
push:
pull_request:
types: [opened, synchronize]

jobs:
build:
strategy:
matrix:
image:
- name: latest
python_version: "3.7"
- name: python3.7
python_version: "3.7"
- name: python3.6
python_version: "3.6"
- name: python2.7
python_version: "2.7"
- name: python3.7-alpine3.8
python_version: "3.7"
- name: python3.6-alpine3.8
python_version: "3.6"
fail-fast: true
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Install Dependencies
run: python3.7 -m pip install docker pytest
- name: Test Image
run: bash scripts/test.sh
env:
NAME: ${{ matrix.image.name }}
DOCKERFILE: ${{ matrix.image.dockerfile }}
PYTHON_VERSION: ${{ matrix.image.python_version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ crashlytics-build.properties

# Custom
Pipfile.lock
poetry.lock
22 changes: 0 additions & 22 deletions Pipfile

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[![Build Status](https://travis-ci.org/tiangolo/meinheld-gunicorn-docker.svg?branch=master)](https://travis-ci.org/tiangolo/meinheld-gunicorn-docker)
[![Test](https://github.com/tiangolo/meinheld-gunicorn-docker/workflows/Test/badge.svg)](https://github.com/tiangolo/meinheld-gunicorn-docker/actions?query=workflow%3ATest) [![Deploy](https://github.com/tiangolo/meinheld-gunicorn-docker/workflows/Deploy/badge.svg)](https://github.com/tiangolo/meinheld-gunicorn-docker/actions?query=workflow%3ADeploy)

## Supported tags and respective `Dockerfile` links

* [`python3.7`, `latest` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/python3.7/Dockerfile)
* [`python3.6` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/python3.6/Dockerfile)
* [`python2.7` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/python2.7/Dockerfile)
* [`python3.6-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/python3.6-alpine3.8/Dockerfile)
* [`python3.7-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/python3.7-alpine3.8/Dockerfile)
* [`python3.7`, `latest` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.7.dockerfile)
* [`python3.6` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.6.dockerfile)
* [`python2.7` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python2.7.dockerfile)
* [`python3.6-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.6-alpine3.8.dockerfile)
* [`python3.7-alpine3.8` _(Dockerfile)_](https://github.com/tiangolo/meinheld-gunicorn-docker/blob/master/docker-images/python3.7-alpine3.8.dockerfile)

**Note**: Note: There are [tags for each build date](https://hub.docker.com/r/tiangolo/meinheld-gunicorn/tags). If you need to "pin" the Docker image version you use, you can select one of those tags. E.g. `tiangolo/meinheld-gunicorn:python3.7-2019-10-15`.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import print_function

import json
import multiprocessing
import os
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mypy]
disallow_untyped_defs = True
ignore_missing_imports = True
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "meinheld-gunicorn-docker"
version = "0.1.0"
description = "Docker image with Meinheld managed by Gunicorn for high-performance web applications in Python 3.6 and above and Python 2.7, with performance auto-tuning. Optionally with Alpine Linux."
authors = ["Sebastián Ramírez <[email protected]>"]
license = "MIT"

[tool.poetry.dependencies]
python = "^3.6"
docker = "^4.2.0"
pytest = "^5.4.1"

[tool.poetry.dev-dependencies]
black = "^19.10b0"
isort = "^4.3.21"
autoflake = "^1.3.1"
mypy = "^0.770"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
10 changes: 0 additions & 10 deletions python3.6-alpine3.8/app/main.py

This file was deleted.

12 changes: 0 additions & 12 deletions python3.6-alpine3.8/app/prestart.sh

This file was deleted.

22 changes: 0 additions & 22 deletions python3.6-alpine3.8/entrypoint.sh

This file was deleted.

42 changes: 0 additions & 42 deletions python3.6-alpine3.8/gunicorn_conf.py

This file was deleted.

15 changes: 0 additions & 15 deletions python3.6-alpine3.8/start.sh

This file was deleted.

10 changes: 0 additions & 10 deletions python3.6/app/main.py

This file was deleted.

12 changes: 0 additions & 12 deletions python3.6/app/prestart.sh

This file was deleted.

22 changes: 0 additions & 22 deletions python3.6/entrypoint.sh

This file was deleted.

42 changes: 0 additions & 42 deletions python3.6/gunicorn_conf.py

This file was deleted.

15 changes: 0 additions & 15 deletions python3.6/start.sh

This file was deleted.

Loading

0 comments on commit 9157f88

Please sign in to comment.