Feat: started CI/CD work
This commit is contained in:
0
.woodpecker.yml
Normal file
0
.woodpecker.yml
Normal file
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM python:3.13.1-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY poetry.lock pyproject.toml ./
|
||||||
|
|
||||||
|
RUN pip install poetry
|
||||||
|
|
||||||
|
RUN poetry config virtualenvs.create false
|
||||||
|
RUN poetry install --no-interaction --no-ansi
|
||||||
|
|
||||||
|
COPY .env .
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV POSTGRES_PORT=5432
|
||||||
|
|
||||||
|
CMD ["python", "main.py"]
|
||||||
@@ -1,10 +1,42 @@
|
|||||||
services:
|
services:
|
||||||
|
bot:
|
||||||
|
image: aboba:latest
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
networks:
|
||||||
|
- bot_network
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:alpine
|
image: postgres:alpine
|
||||||
restart: always
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||||
POSTGRES_USER: ${POSTGRES_USER}
|
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||||
POSTGRES_DB: ${POSTGRES_DB}
|
POSTGRES_DB: ${POSTGRES_DB:-postgres}
|
||||||
ports:
|
ports:
|
||||||
- ${POSTGRES_PORT}:5432
|
- 5432
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pg_isready"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
networks:
|
||||||
|
- bot_network
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
bot_network:
|
||||||
|
driver: overlay
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
@@ -9,7 +9,7 @@ class Settings(BaseSettings):
|
|||||||
postgres_password: SecretStr = Field('password', env="POSTGRES_PASSWORD")
|
postgres_password: SecretStr = Field('password', env="POSTGRES_PASSWORD")
|
||||||
postgres_db: str = Field('db', env="POSTGRES_DB")
|
postgres_db: str = Field('db', env="POSTGRES_DB")
|
||||||
postgres_host: str = Field('localhost', env="POSTGRES_HOST")
|
postgres_host: str = Field('localhost', env="POSTGRES_HOST")
|
||||||
postgres_port: int = Field(15432, env="POSTGRES_PORT")
|
postgres_port: int = Field(5432, env="POSTGRES_PORT")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def postgres_url(self) -> str:
|
def postgres_url(self) -> str:
|
||||||
|
|||||||
11
supervisord.conf
Normal file
11
supervisord.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=false
|
||||||
|
|
||||||
|
[program:mybot]
|
||||||
|
command=python main.py
|
||||||
|
directory=/app
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
stderr_logfile=/app/bot_err.log
|
||||||
|
stdout_logfile=/app/bot_out.log
|
||||||
Reference in New Issue
Block a user