Bootstrap something to start

This commit is contained in:
Luke Murphy 2020-06-30 20:28:47 +02:00
parent 26caa797b2
commit 7dad478dda
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
11 changed files with 138 additions and 0 deletions

18
.drone.yml Normal file
View File

@ -0,0 +1,18 @@
---
matrix:
include:
- IMAGE: 3.8-buster
TOXENV: py38
- IMAGE: 3.8-buster
TOXENV: lint
- IMAGE: 3.8-buster
TOXENV: sort
- IMAGE: 3.8-buster
TOXENV: format
pipeline:
build:
image: python:${IMAGE}
commands:
- pip install tox
- tox -e ${TOXENV}

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
*.egg-info/
*.pyc
.coverage
.eggs/
.mypy_cache/
.tox/
.venv/
__pycache__
build/
dist/
pip-wheel-metadata/
documentation/build/

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM python:3.8-alpine
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
CMD ["python", "magic_app/app.py"]

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
build:
@docker build -t autonomic/magicapp .
run:
@docker run --rm -p 5000:5000 autonomic/magicapp
publish:
@docker push autonomic/magicapp:v0.1.0
.PHONY: build run

View File

@ -1,3 +1,18 @@
# The Magic App
A swarm of dreams.
## Go Go Go No Docker
```bash
$ python3 -m venv .venv && source .venv/bin/activate
$ pip install -r requirements.txt
$ python run.py
```
## Go Go Go Yes Docker
```bash
$ make build
$ make run
```

14
magic_app/app.py Normal file
View File

@ -0,0 +1,14 @@
"""The Magic App."""
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(host="0.0.0.0")

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>The Magic App</title>
</head>
<body>
Hello, World.
</body>
</html>

11
pyproject.toml Normal file
View File

@ -0,0 +1,11 @@
[build-system]
requires = [
"setuptools",
"setuptools-scm",
"wheel",
]
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 80
target-version = ["py38"]

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
flask>=1.1.2,<2

12
setup.py Normal file
View File

@ -0,0 +1,12 @@
from setuptools import find_packages, setup
setup(
name="magic-app",
version="0.0.1a1",
url="https://git.autonomic.zone/autonomic-cooperative/the-magic-app",
author="Autonomic Cooperative",
author_email="helo@autonomic.zone",
description="The Magic App",
packages=find_packages(),
install_requires=["flask>=1.1.2,<2"],
)

25
tox.ini Normal file
View File

@ -0,0 +1,25 @@
[tox]
envlist =
py38
lint
sort
format
skip_missing_interpreters = True
isolated_build = True
[testenv]
[testenv:lint]
skipdist = True
deps = flake8
commands = flake8 {posargs} magic_app/
[testenv:sort]
skipdist = True
deps = isort
commands = isort {posargs:-rc -c} -sp setup.cfg magic_app/
[testenv:format]
skipdist = True
deps = black
commands = black {posargs:--check} magic_app/