add docker

This commit is contained in:
itqop 2025-10-18 16:13:59 +03:00
parent 9501ea92fe
commit 474303407e
3 changed files with 105 additions and 0 deletions

63
.dockerignore Normal file
View File

@ -0,0 +1,63 @@
# Git
.git
.gitignore
# Python
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.git
.mypy_cache
.pytest_cache
.hypothesis
# Virtual environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Project specific
tests/
*.md
README.md
DEPLOYMENT.md
API_EXAMPLES.md
db.ddl
# Docker
Dockerfile
docker-compose.yml
.dockerignore

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN pip install poetry
COPY pyproject.toml poetry.lock ./
RUN poetry config virtualenvs.create false
RUN poetry install --only=main --no-dev
COPY src/ ./src/
RUN useradd --create-home --shell /bin/bash app && chown -R app:app /app
USER app
EXPOSE 8080
CMD ["python", "-m", "hubgw"]

17
docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
services:
hubgw:
build: .
ports:
- "8087:8080"
environment:
- PYTHONPATH=/app/src
volumes:
# Монтируем логи если нужно
- ./logs:/app/logs
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s