From 2c26b2fe65fb0fc76c09e8b23903a35dfed83b0d Mon Sep 17 00:00:00 2001 From: Egor Deev Date: Mon, 5 Oct 2026 17:23:12 +0000 Subject: [PATCH] =?UTF-8?q?docker-compose:=20PostgreSQL=2015=20=D1=81?= =?UTF-8?q?=D0=BE=20=D1=81=D1=85=D0=B5=D0=BC=D0=BE=D0=B9=20=D0=BA=D1=83?= =?UTF-8?q?=D1=80=D1=81=D0=BE=D0=B2=D0=BE=D0=B9=20=D0=B8=20=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D1=8E=20=D0=BF=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB?= =?UTF-8?q?=D1=87=D0=B0=D0=BD=D0=B8=D1=8E=20=D0=B4=D0=BB=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compose.yaml | 20 ++++++++++++++++++++ docker/00-roles.sql | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 compose.yaml create mode 100644 docker/00-roles.sql diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..c93cbfb --- /dev/null +++ b/compose.yaml @@ -0,0 +1,20 @@ +# Локальный PostgreSQL 15 со схемой курсовой: docker compose up -d +services: + db: + image: postgres:15-alpine + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" + volumes: + - ./docker/00-roles.sql:/docker-entrypoint-initdb.d/00-roles.sql:ro + - ./sql/create_schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro + - pgdata:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d mobile_devices_db"] + interval: 5s + retries: 20 + +volumes: + pgdata: diff --git a/docker/00-roles.sql b/docker/00-roles.sql new file mode 100644 index 0000000..ce35956 --- /dev/null +++ b/docker/00-roles.sql @@ -0,0 +1,2 @@ +-- Роль приложения для локального стенда (значения по умолчанию из database.py) +CREATE ROLE admin LOGIN SUPERUSER PASSWORD 'password';