From 64c6166585a86a8f5ccec9c3e00fa4774c513fb2 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 6 Jan 2026 15:26:41 +0300 Subject: [PATCH 1/3] fix --- .dockerignore | 12 ++++++++++++ .gitignore | 1 + Dockerfile.python | 10 ++++++++++ compose.yaml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile.python create mode 100644 compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..0890af733 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.idea +.git +schema.pdf +LICENCE +Dockerfile.python +*.md +.gitignore +Dockerfile* +compose.yaml +.env +*.md +*.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..2eea525d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/Dockerfile.python b/Dockerfile.python new file mode 100644 index 000000000..1bbf3b474 --- /dev/null +++ b/Dockerfile.python @@ -0,0 +1,10 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY . . + +RUN pip install -r requirements.txt + +# Запускаем приложение с помощью uvicorn, делая его доступным по сети +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 000000000..feb2b94f8 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,45 @@ +include: + - proxy.yaml +services: + web: + build: + context: . + dockerfile: Dockerfile.python + restart: always + ports: + - "5000:5000" + environment: + - DB_HOST=db + - DB_USER=${MYSQL_USER} + - DB_PASSWORD=${MYSQL_PASSWORD} + - DB_NAME=${MYSQL_DATABASE} + networks: + backend: + ipv4_address: 172.20.0.5 + depends_on: + db: + condition: service_healthy + container_name: python-web-app + + db: + image: mysql:8 + restart: always + environment: + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} + MYSQL_DATABASE: ${MYSQL_DATABASE} + MYSQL_USER: ${MYSQL_USER} + MYSQL_PASSWORD: ${MYSQL_PASSWORD} + networks: + backend: + ipv4_address: 172.20.0.10 + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] + timeout: 20s + retries: 10 + container_name: mysql-db + volumes: + - mysql_data:/var/lib/mysql + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + +volumes: + mysql_data: \ No newline at end of file From b5dd574cb7471232b97ae5949a03d0bd991b4218 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 6 Jan 2026 15:36:40 +0300 Subject: [PATCH 2/3] add file.sh --- docker-compose.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 docker-compose.sh diff --git a/docker-compose.sh b/docker-compose.sh new file mode 100755 index 000000000..fa6aa19f6 --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +sudo snap install docker +sudo apt install docker-compose + +cd /opt +git clone https://github.com/goosecompote/shvirtd-example-python +cd /opt/shvirtd-example-python +docker compose up -d From e44e8d0d741f9f18cb121f4128fdbab48b6ffba5 Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Tue, 6 Jan 2026 15:48:18 +0300 Subject: [PATCH 3/3] add --- docker-compose.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.sh b/docker-compose.sh index fa6aa19f6..6005899c4 100755 --- a/docker-compose.sh +++ b/docker-compose.sh @@ -1,5 +1,6 @@ #!/bin/bash +sudo apt install snapd sudo snap install docker sudo apt install docker-compose