commit 1da0f08bc2997dc513f31c34b40a8135f4ae7293 Author: Kenneth Allen Date: Mon Jun 26 16:22:19 2023 +1000 Dockerize a basic app diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9295980 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.11 + +RUN pip3 install poetry +RUN poetry config virtualenvs.create false + +RUN mkdir /opt/app +WORKDIR /opt/app + +COPY pyproject.toml poetry.lock ./ +RUN poetry install --no-dev + +COPY ./ ./ + +CMD ["flask", "run", "--host", "0.0.0.0"] diff --git a/app.py b/app.py new file mode 100644 index 0000000..34b7b8f --- /dev/null +++ b/app.py @@ -0,0 +1,8 @@ +from flask import Flask + +app = Flask(__name__) + +@app.route('/') +def index(): + return 'Web App with Python Flask!' + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..c53add1 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,6 @@ +services: + app: + build: . + init: true + ports: + - "127.0.0.1:5123:5000" diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..64eac0d --- /dev/null +++ b/poetry.lock @@ -0,0 +1,104 @@ +[[package]] +name = "blinker" +version = "1.6.2" +description = "Fast, simple object-to-object and broadcast signaling" +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" + +[[package]] +name = "flask" +version = "2.3.2" +description = "A simple framework for building complex web applications." +category = "main" +optional = false +python-versions = ">=3.8" + +[package.dependencies] +blinker = ">=1.6.2" +click = ">=8.1.3" +itsdangerous = ">=2.1.2" +Jinja2 = ">=3.1.2" +Werkzeug = ">=2.3.3" + +[package.extras] +async = ["asgiref (>=3.2)"] +dotenv = ["python-dotenv"] + +[[package]] +name = "itsdangerous" +version = "2.1.2" +description = "Safely pass data to untrusted environments and back." +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "jinja2" +version = "3.1.2" +description = "A very fast and expressive template engine." +category = "main" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "markupsafe" +version = "2.1.3" +description = "Safely add untrusted strings to HTML/XML markup." +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "werkzeug" +version = "2.3.6" +description = "The comprehensive WSGI web application library." +category = "main" +optional = false +python-versions = ">=3.8" + +[package.dependencies] +MarkupSafe = ">=2.1.1" + +[package.extras] +watchdog = ["watchdog (>=2.3)"] + +[metadata] +lock-version = "1.1" +python-versions = "^3.10" +content-hash = "d7a65ba75d9fd1d70398a76955d93d28129b8c09a3b56e10fef71ce427090c8b" + +[metadata.files] +blinker = [] +click = [] +colorama = [] +flask = [] +itsdangerous = [] +jinja2 = [] +markupsafe = [] +werkzeug = [] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..74113a8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "poetry-test" +version = "0.1.0" +description = "" +authors = ["Kenneth Allen "] + +[tool.poetry.dependencies] +python = "^3.10" +Flask = "^2.3.2" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"