db change

This commit is contained in:
2026-08-29 13:04:41 +03:00
parent 443d40d7b6
commit 198506f062
21 changed files with 455 additions and 555 deletions
+63
View File
@@ -11,6 +11,8 @@ services:
target: dev
init: true #Manage processes and reap zombies
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
environment:
- DB_HOST=psql
volumes:
- type: bind
source: ../src
@@ -32,6 +34,11 @@ services:
target: /home/excel-project/logs
networks:
- backend
depends_on:
psql:
condition: service_healthy
migration:
condition: service_completed_successfully
ports:
- "80:8000"
entrypoint: ["./entrypoint.sh", "--dev"]
@@ -46,6 +53,8 @@ services:
target: prod
init: true #Manage processes and reap zombies
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
environment:
- DB_HOST=psql
volumes:
- type: bind
source: ../configs
@@ -62,9 +71,63 @@ services:
networks:
- backend
restart: unless-stopped
depends_on:
psql:
condition: service_healthy
migration:
condition: service_completed_successfully
ports:
- "80:8000"
psql:
profiles: ["prod", "dev", "db"]
image: postgres:16-alpine
container_name: psql
init: true
ipc: private
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_POSTGRESS}
volumes:
- type: bind
source: ../DB
target: /var/lib/postgresql/data
networks:
- backend
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_POSTGRESS}"]
interval: 5s
timeout: 5s
retries: 5
ports:
- "5432:5432"
migration:
profiles: ["prod", "dev"]
image: "${DOCKER_REGISTRY:-local}/migration-tool:${IMAGE_TAG:-local}"
build:
dockerfile: ./docker/dockerfile
context: ../
target: migration-tool
environment:
- DB_HOST=psql
volumes:
- type: bind
source: ../configs
target: /home/excel-project/configs
- type: bind
source: ../src/migrations
target: /home/excel-project/src/migrations
depends_on:
- psql
networks:
- backend
networks:
backend:
name: "${BACKEND_NETWORK:-backend_network}"
+28 -4
View File
@@ -1,8 +1,8 @@
# --- Stage 1: Python Backend dev ---
FROM python:3.14-slim AS dev
LABEL org.opencontainers.image.title="the-great-excel-project-dev"
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project"
LABEL org.opencontainers.image.title="The-DisExcel-project-dev"
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
WORKDIR /home/excel-project
@@ -18,8 +18,8 @@ RUN pip install --no-cache-dir --break-system-packages poetry \
FROM python:3.14-slim AS prod
LABEL org.opencontainers.image.title="the-great-excel-project-prod"
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project"
LABEL org.opencontainers.image.title="The-DisExcel-project-prod"
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
WORKDIR /home/excel-project
@@ -39,3 +39,27 @@ RUN groupadd --gid 1000 appuser \
USER appuser
ENTRYPOINT ["./entrypoint.sh", "--prod"]
FROM python:3.14-slim AS migration-tool
LABEL org.opencontainers.image.title="The-DisExcel-project"
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
WORKDIR /home/excel-project
COPY pyproject.toml poetry.lock alembic.ini ./
COPY src/models/database_models ./src/models/database_models
COPY src/models/configs_read ./src/models/configs_read
RUN pip install --no-cache-dir --break-system-packages poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-root --no-interaction --only main
RUN groupadd --gid 1000 appuser \
&& useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser \
&& chown -R appuser:appuser /home/excel-project
USER appuser
CMD ["alembic", "upgrade", "head"]