feat: add docker preset

This commit is contained in:
2026-08-01 21:06:30 +03:00
parent 9a9338cfdc
commit 48f8b2d5a9
13 changed files with 80 additions and 31 deletions
@@ -0,0 +1,16 @@
[presets.docker]
conditions = ["file(Dockerfile)"]
# build
[presets.docker.tasks.build.default]
variables.docker_target = "file(.env) | get(DOCKER_PROJECTS)"
variables.docker_name = "file(pyproject.toml) | get(project.name)"
variables.docker_group = "file(.env) | get(DOCKER_GROUP)"
commands = [
# "docker build --target {docker_target} -t {docker_group}/{docker_name} . -f Dockerfile",
"docker build -t {docker_group}/{docker_name} . -f Dockerfile",
]
# publish
[presets.docker.tasks.publish.default]
commands = ["docker publish"]
+11 -4
View File
@@ -1,6 +1,7 @@
[presets.python]
conditions = ["file(pyproject.toml)"]
# setup
[presets.python.tasks.setup.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
@@ -11,12 +12,14 @@ commands = [
"poetry install",
]
# build
[presets.python.tasks.build.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
]
commands = ["poetry build"]
# publish
[presets.python.tasks.publish.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
@@ -25,10 +28,12 @@ conditions = [
variables.python_repository = "file(poetry.toml) | get(repositories) | key(0)"
commands = ["poetry publish -r {python_repository}"]
# test
[presets.python.tasks.test.pytest]
conditions = ["file(.venv/bin/pytest)"]
commands = [".venv/bin/python -m pytest"]
# lint
[presets.python.tasks.lint.pylint]
conditions = ["file(.venv/bin/pylint)"]
commands = [".venv/bin/pylint ./"]
@@ -37,18 +42,20 @@ commands = [".venv/bin/pylint ./"]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black --check-only ./"]
[presets.python.tasks.format.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black ./"]
[presets.python.tasks.lint.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black --check --diff ./"]
# format
[presets.python.tasks.format.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black ./"]
[presets.python.tasks.format.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black ./"]
# clean
[presets.python.tasks.clean.venv]
conditions = ["file(.venv)"]
commands = ["rm -rf .venv"]