From fb52ce868a7fd1ff49914eade8c15975f7a44e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 2 Nov 2024 15:11:36 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A5=20Drop=20support=20for=20Pytho?= =?UTF-8?q?n=203.7=20and=203.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 4 ---- .github/workflows/test.yml | 4 ---- docker-images/python3.7.dockerfile | 37 ------------------------------ docker-images/python3.8.dockerfile | 37 ------------------------------ 4 files changed, 82 deletions(-) delete mode 100644 docker-images/python3.7.dockerfile delete mode 100644 docker-images/python3.8.dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f2c790dd..1b55e861 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,10 +23,6 @@ jobs: python_version: "3.10" - name: python3.9 python_version: "3.9" - - name: python3.8 - python_version: "3.8" - - name: python3.7 - python_version: "3.7" fail-fast: true runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff05f9ec..e7cf8165 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,10 +27,6 @@ jobs: python_version: "3.10" - name: python3.9 python_version: "3.9" - - name: python3.8 - python_version: "3.8" - - name: python3.7 - python_version: "3.7" fail-fast: true runs-on: ubuntu-latest steps: diff --git a/docker-images/python3.7.dockerfile b/docker-images/python3.7.dockerfile deleted file mode 100644 index ce2be258..00000000 --- a/docker-images/python3.7.dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM tiangolo/uwsgi-nginx:python3.7 - -LABEL maintainer="Sebastian Ramirez " - -# Install requirements -COPY requirements.txt /tmp/requirements.txt -RUN pip install --no-cache-dir -r /tmp/requirements.txt - -# URL under which static (not modified by Python) files will be requested -# They will be served by Nginx directly, without being handled by uWSGI -ENV STATIC_URL /static -# Absolute path in where the static files wil be -ENV STATIC_PATH /app/static - -# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured) -# ENV STATIC_INDEX 1 -ENV STATIC_INDEX 0 - -# Add demo app -COPY ./app /app -WORKDIR /app - -# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. -ENV PYTHONPATH=/app - -# Move the base entrypoint to reuse it -RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh -# Copy the entrypoint that will generate Nginx additional configs -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] - -# Run the start script provided by the parent image tiangolo/uwsgi-nginx. -# It will check for an /app/prestart.sh script (e.g. for migrations) -# And then will start Supervisor, which in turn will start Nginx and uWSGI -CMD ["/start.sh"] diff --git a/docker-images/python3.8.dockerfile b/docker-images/python3.8.dockerfile deleted file mode 100644 index 609f59b9..00000000 --- a/docker-images/python3.8.dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM tiangolo/uwsgi-nginx:python3.8 - -LABEL maintainer="Sebastian Ramirez " - -# Install requirements -COPY requirements.txt /tmp/requirements.txt -RUN pip install --no-cache-dir -r /tmp/requirements.txt - -# URL under which static (not modified by Python) files will be requested -# They will be served by Nginx directly, without being handled by uWSGI -ENV STATIC_URL /static -# Absolute path in where the static files wil be -ENV STATIC_PATH /app/static - -# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured) -# ENV STATIC_INDEX 1 -ENV STATIC_INDEX 0 - -# Add demo app -COPY ./app /app -WORKDIR /app - -# Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. -ENV PYTHONPATH=/app - -# Move the base entrypoint to reuse it -RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh -# Copy the entrypoint that will generate Nginx additional configs -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] - -# Run the start script provided by the parent image tiangolo/uwsgi-nginx. -# It will check for an /app/prestart.sh script (e.g. for migrations) -# And then will start Supervisor, which in turn will start Nginx and uWSGI -CMD ["/start.sh"] From 84aa5411eff0b9505ce03f88557ac0725158fe4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 2 Nov 2024 15:12:05 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A5=20Remove=20outdated=20example?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example-flask-package-python3.8/Dockerfile | 3 -- .../app/app/__init__.py | 0 .../app/app/api/__init__.py | 0 .../app/app/api/api.py | 1 - .../app/app/api/endpoints/__init__.py | 0 .../app/app/api/endpoints/user.py | 15 -------- .../app/app/api/utils.py | 3 -- .../app/app/core/__init__.py | 0 .../app/app/core/app_setup.py | 10 ------ .../app/app/core/database.py | 6 ---- .../app/app/main.py | 10 ------ .../app/app/models/__init__.py | 0 .../app/app/models/user.py | 6 ---- example-flask-package-python3.8/app/uwsgi.ini | 3 -- .../docker-compose.override.yml | 14 -------- .../docker-compose.yml | 4 --- example-flask-python3.8-index/Dockerfile | 7 ---- example-flask-python3.8-index/app/main.py | 36 ------------------- .../app/static/index.html | 10 ------ example-flask-python3.8-index/app/uwsgi.ini | 3 -- .../docker-compose.override.yml | 14 -------- .../docker-compose.yml | 4 --- example-flask-python3.8/Dockerfile | 3 -- example-flask-python3.8/app/main.py | 14 -------- example-flask-python3.8/app/uwsgi.ini | 3 -- .../docker-compose.override.yml | 14 -------- example-flask-python3.8/docker-compose.yml | 4 --- make-example-zips.sh | 13 ------- 28 files changed, 200 deletions(-) delete mode 100644 example-flask-package-python3.8/Dockerfile delete mode 100644 example-flask-package-python3.8/app/app/__init__.py delete mode 100644 example-flask-package-python3.8/app/app/api/__init__.py delete mode 100644 example-flask-package-python3.8/app/app/api/api.py delete mode 100644 example-flask-package-python3.8/app/app/api/endpoints/__init__.py delete mode 100644 example-flask-package-python3.8/app/app/api/endpoints/user.py delete mode 100644 example-flask-package-python3.8/app/app/api/utils.py delete mode 100644 example-flask-package-python3.8/app/app/core/__init__.py delete mode 100644 example-flask-package-python3.8/app/app/core/app_setup.py delete mode 100644 example-flask-package-python3.8/app/app/core/database.py delete mode 100644 example-flask-package-python3.8/app/app/main.py delete mode 100644 example-flask-package-python3.8/app/app/models/__init__.py delete mode 100644 example-flask-package-python3.8/app/app/models/user.py delete mode 100644 example-flask-package-python3.8/app/uwsgi.ini delete mode 100644 example-flask-package-python3.8/docker-compose.override.yml delete mode 100644 example-flask-package-python3.8/docker-compose.yml delete mode 100644 example-flask-python3.8-index/Dockerfile delete mode 100644 example-flask-python3.8-index/app/main.py delete mode 100644 example-flask-python3.8-index/app/static/index.html delete mode 100644 example-flask-python3.8-index/app/uwsgi.ini delete mode 100644 example-flask-python3.8-index/docker-compose.override.yml delete mode 100644 example-flask-python3.8-index/docker-compose.yml delete mode 100644 example-flask-python3.8/Dockerfile delete mode 100644 example-flask-python3.8/app/main.py delete mode 100644 example-flask-python3.8/app/uwsgi.ini delete mode 100644 example-flask-python3.8/docker-compose.override.yml delete mode 100644 example-flask-python3.8/docker-compose.yml delete mode 100644 make-example-zips.sh diff --git a/example-flask-package-python3.8/Dockerfile b/example-flask-package-python3.8/Dockerfile deleted file mode 100644 index 960c7e24..00000000 --- a/example-flask-package-python3.8/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM tiangolo/uwsgi-nginx-flask:python3.8 - -COPY ./app /app diff --git a/example-flask-package-python3.8/app/app/__init__.py b/example-flask-package-python3.8/app/app/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example-flask-package-python3.8/app/app/api/__init__.py b/example-flask-package-python3.8/app/app/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example-flask-package-python3.8/app/app/api/api.py b/example-flask-package-python3.8/app/app/api/api.py deleted file mode 100644 index ae7e7fce..00000000 --- a/example-flask-package-python3.8/app/app/api/api.py +++ /dev/null @@ -1 +0,0 @@ -from .endpoints import user # noqa diff --git a/example-flask-package-python3.8/app/app/api/endpoints/__init__.py b/example-flask-package-python3.8/app/app/api/endpoints/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example-flask-package-python3.8/app/app/api/endpoints/user.py b/example-flask-package-python3.8/app/app/api/endpoints/user.py deleted file mode 100644 index 39c35d48..00000000 --- a/example-flask-package-python3.8/app/app/api/endpoints/user.py +++ /dev/null @@ -1,15 +0,0 @@ -from flask import jsonify - -from ...core.database import users -from ...main import app -from ..utils import senseless_print - - -@app.route("/users/") -def route_users(): - users_data = [] - for user in users: - user_data = {"name": user.name, "email": user.email} - users_data.append(user_data) - senseless_print() - return jsonify(users_data) diff --git a/example-flask-package-python3.8/app/app/api/utils.py b/example-flask-package-python3.8/app/app/api/utils.py deleted file mode 100644 index 4b2ed564..00000000 --- a/example-flask-package-python3.8/app/app/api/utils.py +++ /dev/null @@ -1,3 +0,0 @@ -def senseless_print(): - # Print something, just to demonstrate how to import modules - print("Senseless print") diff --git a/example-flask-package-python3.8/app/app/core/__init__.py b/example-flask-package-python3.8/app/app/core/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example-flask-package-python3.8/app/app/core/app_setup.py b/example-flask-package-python3.8/app/app/core/app_setup.py deleted file mode 100644 index bb2422b6..00000000 --- a/example-flask-package-python3.8/app/app/core/app_setup.py +++ /dev/null @@ -1,10 +0,0 @@ -from ..api import api # noqa -from ..main import app - - -@app.route("/") -def hello(): - # This could also be returning an index.html - return """Hello World from Flask in a uWSGI Nginx Docker container with \ - Python 3.7 (from the example template), - try also: /users/""" diff --git a/example-flask-package-python3.8/app/app/core/database.py b/example-flask-package-python3.8/app/app/core/database.py deleted file mode 100644 index 007602b2..00000000 --- a/example-flask-package-python3.8/app/app/core/database.py +++ /dev/null @@ -1,6 +0,0 @@ -from ..models.user import User - -users = [ - User("Alice Example", "alice@example.com"), - User("Bob Example", "bob@example.com"), -] diff --git a/example-flask-package-python3.8/app/app/main.py b/example-flask-package-python3.8/app/app/main.py deleted file mode 100644 index fd63dca1..00000000 --- a/example-flask-package-python3.8/app/app/main.py +++ /dev/null @@ -1,10 +0,0 @@ -from flask import Flask - -app = Flask(__name__) - -from .core import app_setup - - -if __name__ == "__main__": - # Only for debugging while developing - app.run(host="0.0.0.0", debug=True, port=80) diff --git a/example-flask-package-python3.8/app/app/models/__init__.py b/example-flask-package-python3.8/app/app/models/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/example-flask-package-python3.8/app/app/models/user.py b/example-flask-package-python3.8/app/app/models/user.py deleted file mode 100644 index 5389428c..00000000 --- a/example-flask-package-python3.8/app/app/models/user.py +++ /dev/null @@ -1,6 +0,0 @@ -# This could be a SQLAlchemy model, -# an ElasticSearch document, a MongoDB document, etc -class User: - def __init__(self, name, email): - self.name = name - self.email = email diff --git a/example-flask-package-python3.8/app/uwsgi.ini b/example-flask-package-python3.8/app/uwsgi.ini deleted file mode 100644 index c69c38fd..00000000 --- a/example-flask-package-python3.8/app/uwsgi.ini +++ /dev/null @@ -1,3 +0,0 @@ -[uwsgi] -module = app.main -callable = app diff --git a/example-flask-package-python3.8/docker-compose.override.yml b/example-flask-package-python3.8/docker-compose.override.yml deleted file mode 100644 index b4fd6230..00000000 --- a/example-flask-package-python3.8/docker-compose.override.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '3' -services: - web: - volumes: - - ./app:/app - ports: - - "80:80" - environment: - - FLASK_APP=app/main.py - - FLASK_DEBUG=1 - - 'RUN=flask run --host=0.0.0.0 --port=80' - # command: flask run --host=0.0.0.0 --port=80 - # Infinite loop, to keep it alive, for debugging - # command: bash -c "while true; do echo 'sleeping...' && sleep 10; done" diff --git a/example-flask-package-python3.8/docker-compose.yml b/example-flask-package-python3.8/docker-compose.yml deleted file mode 100644 index 77983a28..00000000 --- a/example-flask-package-python3.8/docker-compose.yml +++ /dev/null @@ -1,4 +0,0 @@ -version: '3' -services: - web: - build: ./ diff --git a/example-flask-python3.8-index/Dockerfile b/example-flask-python3.8-index/Dockerfile deleted file mode 100644 index d0638a42..00000000 --- a/example-flask-python3.8-index/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM tiangolo/uwsgi-nginx-flask:python3.8 - -# If STATIC_INDEX is 1, serve / with /static/index.html directly (or the static URL configured) -ENV STATIC_INDEX 1 -# ENV STATIC_INDEX 0 - -COPY ./app /app diff --git a/example-flask-python3.8-index/app/main.py b/example-flask-python3.8-index/app/main.py deleted file mode 100644 index b864f543..00000000 --- a/example-flask-python3.8-index/app/main.py +++ /dev/null @@ -1,36 +0,0 @@ -import os - -from flask import Flask, send_file - -app = Flask(__name__) - - -@app.route("/hello") -def hello(): - return "Hello World from Flask in a uWSGI Nginx Docker container with \ - Python 3.7 (from the example template)" - - -@app.route("/") -def main(): - index_path = os.path.join(app.static_folder, "index.html") - return send_file(index_path) - - -# Everything not declared before (not a Flask route / API endpoint)... -@app.route("/") -def route_frontend(path): - # ...could be a static file needed by the front end that - # doesn't use the `static` path (like in `