mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
Merge pull request #224 from grillazz/switch-logger-to-rotoger
docker arch refactor
This commit is contained in:
2
.github/workflows/build-and-test.yml
vendored
2
.github/workflows/build-and-test.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [ "3.13" ]
|
python-version: [ "3.14" ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHONDONTWRITEBYTECODE: 1
|
PYTHONDONTWRITEBYTECODE: 1
|
||||||
|
|||||||
37
Dockerfile
37
Dockerfile
@@ -1,32 +1,28 @@
|
|||||||
FROM ubuntu:oracular AS build
|
FROM ubuntu:25.10 AS base
|
||||||
|
|
||||||
RUN apt-get update -qy && apt-get install -qyy \
|
RUN apt-get update -qy \
|
||||||
|
&& apt-get install -qyy \
|
||||||
-o APT::Install-Recommends=false \
|
-o APT::Install-Recommends=false \
|
||||||
-o APT::Install-Suggests=false \
|
-o APT::Install-Suggests=false \
|
||||||
build-essential \
|
build-essential \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
python3-setuptools \
|
python3-setuptools \
|
||||||
python3.13-dev \
|
python3.14-dev
|
||||||
git
|
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
ENV UV_LINK_MODE=copy \
|
ENV UV_LINK_MODE=copy \
|
||||||
UV_COMPILE_BYTECODE=1 \
|
UV_COMPILE_BYTECODE=1 \
|
||||||
UV_PYTHON_DOWNLOADS=never \
|
UV_PYTHON=python3.14 \
|
||||||
UV_PYTHON=python3.13 \
|
|
||||||
UV_PROJECT_ENVIRONMENT=/panettone
|
UV_PROJECT_ENVIRONMENT=/panettone
|
||||||
|
|
||||||
COPY pyproject.toml /_lock/
|
COPY pyproject.toml /_lock/
|
||||||
COPY uv.lock /_lock/
|
COPY uv.lock /_lock/
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache
|
RUN cd /_lock && uv sync --locked --no-install-project
|
||||||
RUN cd /_lock && uv sync \
|
|
||||||
--locked \
|
|
||||||
--no-dev \
|
|
||||||
--no-install-project
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
FROM ubuntu:oracular
|
FROM ubuntu:25.10
|
||||||
|
|
||||||
ENV PATH=/panettone/bin:$PATH
|
ENV PATH=/panettone/bin:$PATH
|
||||||
|
|
||||||
@@ -38,15 +34,14 @@ STOPSIGNAL SIGINT
|
|||||||
RUN apt-get update -qy && apt-get install -qyy \
|
RUN apt-get update -qy && apt-get install -qyy \
|
||||||
-o APT::Install-Recommends=false \
|
-o APT::Install-Recommends=false \
|
||||||
-o APT::Install-Suggests=false \
|
-o APT::Install-Suggests=false \
|
||||||
python3.13 \
|
python3.14 \
|
||||||
libpython3.13 \
|
libpython3.14 \
|
||||||
libpcre3 \
|
libpcre3
|
||||||
libxml2
|
|
||||||
|
|
||||||
RUN apt-get clean
|
RUN apt-get clean
|
||||||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
COPY --from=build --chown=panettone:panettone /panettone /panettone
|
COPY --from=base --chown=panettone:panettone /panettone /panettone
|
||||||
|
|
||||||
USER panettone
|
USER panettone
|
||||||
WORKDIR /panettone
|
WORKDIR /panettone
|
||||||
@@ -56,8 +51,4 @@ COPY /templates/ templates/
|
|||||||
COPY .env app/
|
COPY .env app/
|
||||||
COPY alembic.ini /panettone/alembic.ini
|
COPY alembic.ini /panettone/alembic.ini
|
||||||
COPY /alembic/ /panettone/alembic/
|
COPY /alembic/ /panettone/alembic/
|
||||||
COPY pyproject.toml /panettone/pyproject.toml
|
COPY pyproject.toml /panettone/pyproject.toml
|
||||||
|
|
||||||
RUN python -V
|
|
||||||
RUN python -Im site
|
|
||||||
RUN python -Ic 'import uvicorn'
|
|
||||||
2
Makefile
2
Makefile
@@ -26,7 +26,7 @@ docker-up: ## Run project with compose
|
|||||||
docker-clean: ## Clean and reset project containers and volumes
|
docker-clean: ## Clean and reset project containers and volumes
|
||||||
docker compose down -v --remove-orphans | true
|
docker compose down -v --remove-orphans | true
|
||||||
docker compose rm -f | true
|
docker compose rm -f | true
|
||||||
docker volume rm panettone_postgres_data | true
|
docker volume ls -q | grep panettone_postgres_data | xargs -r docker volume rm | true
|
||||||
|
|
||||||
# ====================================================================================
|
# ====================================================================================
|
||||||
# DATABASE MIGRATIONS
|
# DATABASE MIGRATIONS
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
postgres:
|
||||||
- redis
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
container_name: panettone_postgres
|
container_name: panettone_postgres
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
[tool.poetry]
|
|
||||||
name = "fastapi-sqlalchemy-asyncpg"
|
|
||||||
version = "0.0.17"
|
|
||||||
description = ""
|
|
||||||
authors = ["Jakub Miazek <the@grillazz.com>"]
|
|
||||||
packages = []
|
|
||||||
license = "MIT"
|
|
||||||
package-mode = false
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.13"
|
|
||||||
fastapi = {version = "^0.115.6", extras = ["all"]}
|
|
||||||
pydantic = {version = "^2.10.3", extras = ["email"]}
|
|
||||||
pydantic-settings = "^2.7.0"
|
|
||||||
sqlalchemy = "^2.0.36"
|
|
||||||
uvicorn = { version = "^0.34.0", extras = ["standard"]}
|
|
||||||
asyncpg = "^0.30.0"
|
|
||||||
alembic = "^1.14.0"
|
|
||||||
httpx = "^0.28.1"
|
|
||||||
pytest = "^8.3.4"
|
|
||||||
pytest-cov = "^6.0.0"
|
|
||||||
uvloop = "^0.21.0"
|
|
||||||
httptools = "^0.6.4"
|
|
||||||
rich = "^13.9.4"
|
|
||||||
pyjwt = {version = "^2.10.1", extras = ["cryptography"]}
|
|
||||||
redis = "^5.2.1"
|
|
||||||
bcrypt = "^4.2.1"
|
|
||||||
polars = "^1.17.1"
|
|
||||||
python-multipart = "^0.0.20"
|
|
||||||
fastexcel = "^0.12.0"
|
|
||||||
fastapi-cache2 = "^0.2.1"
|
|
||||||
inline-snapshot = "^0.17.0"
|
|
||||||
dirty-equals = "^0.8.0"
|
|
||||||
polyfactory = "^2.18.1"
|
|
||||||
granian = "^1.7.0"
|
|
||||||
apscheduler = {version = "^4.0.0a5", extras = ["redis,sqlalchemy"]}
|
|
||||||
pendulum = {git = "https://github.com/sdispater/pendulum.git", rev="develop"}
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
|
||||||
devtools = { extras = ["pygments"], version = "^0.12.2" }
|
|
||||||
safety = "*"
|
|
||||||
pyupgrade = "*"
|
|
||||||
ipython = "^8.26.0"
|
|
||||||
ruff = "^0.6.1"
|
|
||||||
sqlacodegen = "^3.0.0rc5"
|
|
||||||
tryceratops = "^2.3.3"
|
|
||||||
locust = "^2.31.3"
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core>=1.0.0"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
||||||
|
|
||||||
[tool.ruff]
|
|
||||||
line-length = 120
|
|
||||||
indent-width = 4
|
|
||||||
|
|
||||||
lint.select = ["E", "F", "UP", "N", "C", "B"]
|
|
||||||
lint.ignore = ["E501"]
|
|
||||||
|
|
||||||
# Exclude a variety of commonly ignored directories.
|
|
||||||
exclude = ["alembic",]
|
|
||||||
# Assume Python 3.13
|
|
||||||
target-version = "py313"
|
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-quotes]
|
|
||||||
docstring-quotes = "double"
|
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-bugbear]
|
|
||||||
extend-immutable-calls = ["fastapi.Depends",]
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
|
||||||
addopts = "-v --doctest-modules --doctest-glob=*.md --ignore=alembic"
|
|
||||||
asyncio_mode = "strict"
|
|
||||||
env_files = [".env"]
|
|
||||||
|
|
||||||
[tool.tryceratops]
|
|
||||||
exclude = ["alembic",]
|
|
||||||
|
|
||||||
[tool.ruff.format]
|
|
||||||
# Like Black, use double quotes for strings.
|
|
||||||
quote-style = "double"
|
|
||||||
|
|
||||||
# Like Black, indent with spaces, rather than tabs.
|
|
||||||
indent-style = "space"
|
|
||||||
|
|
||||||
# Like Black, respect magic trailing commas.
|
|
||||||
skip-magic-trailing-comma = false
|
|
||||||
|
|
||||||
# Like Black, automatically detect the appropriate line ending.
|
|
||||||
line-ending = "auto"
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "fastapi-sqlalchemy-asyncpg"
|
name = "fastapi-sqlalchemy-asyncpg"
|
||||||
version = "0.21.0"
|
version = "0.22.0"
|
||||||
description = "A modern FastAPI application with SQLAlchemy 2.0 and AsyncPG for high-performance async database operations. Features include JWT authentication with Redis token storage, password hashing, connection pooling, data processing with Polars, Rich logging, task scheduling with APScheduler, and Shakespeare datasets integration."
|
description = "A modern FastAPI application with SQLAlchemy 2.0 and AsyncPG for high-performance async database operations. Features include JWT authentication with Redis token storage, password hashing, connection pooling, data processing with Polars, Rich logging, task scheduling with APScheduler, and Shakespeare datasets integration."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastapi[all]>=0.116.2",
|
"fastapi[all]>=0.116.2",
|
||||||
"pydantic[email]>=2.12.0a1",
|
"pydantic[email]>=2.12.0a1",
|
||||||
"pydantic-settings>=2.10.1",
|
"pydantic-settings>=2.10.1",
|
||||||
"sqlalchemy>=2.0.43",
|
"sqlalchemy==2.0.44",
|
||||||
"uvicorn[standard]>=0.36.0",
|
"uvicorn==0.38.0",
|
||||||
"asyncpg>=0.30.0",
|
"asyncpg>=0.30.0",
|
||||||
"alembic>=1.16.5",
|
"alembic>=1.16.5",
|
||||||
"httpx>=0.28.1",
|
"httpx>=0.28.1",
|
||||||
@@ -21,7 +21,7 @@ dependencies = [
|
|||||||
"pyjwt>=2.10.1",
|
"pyjwt>=2.10.1",
|
||||||
"redis>=6.4.0",
|
"redis>=6.4.0",
|
||||||
"bcrypt>=4.3.0",
|
"bcrypt>=4.3.0",
|
||||||
"polars[pyarrow]>=1.33.1",
|
"polars==1.35.2",
|
||||||
"python-multipart>=0.0.20",
|
"python-multipart>=0.0.20",
|
||||||
"fastexcel>=0.15.1",
|
"fastexcel>=0.15.1",
|
||||||
"inline-snapshot>=0.29.0",
|
"inline-snapshot>=0.29.0",
|
||||||
@@ -29,7 +29,7 @@ dependencies = [
|
|||||||
"polyfactory>=2.22.2",
|
"polyfactory>=2.22.2",
|
||||||
"granian>=2.5.4",
|
"granian>=2.5.4",
|
||||||
"apscheduler[redis,sqlalchemy]>=4.0.0a6",
|
"apscheduler[redis,sqlalchemy]>=4.0.0a6",
|
||||||
"rotoger>=0.1.1",
|
"rotoger==0.1.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.uv]
|
[tool.uv]
|
||||||
|
|||||||
Reference in New Issue
Block a user