Compare commits

...

4 Commits

Author SHA1 Message Date
2c845dbdfd Updated templates 2025-07-21 16:55:56 +03:00
78d578562e Fixed conflicts 2025-07-17 15:54:57 +03:00
bc36158de9 Updated docker configs 2025-07-17 15:52:34 +03:00
90ae2ea8e4 Changed dependency management to poetry 2025-06-24 06:55:47 +03:00
4 changed files with 58 additions and 11 deletions

View File

@ -3,8 +3,6 @@ FROM python:3.12-slim
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait
WORKDIR /app
# Install poetry
@ -24,4 +22,4 @@ RUN poetry install --only main
EXPOSE 8000
CMD /wait; poetry run alembic upgrade head; poetry run fastapi run
CMD poetry run alembic upgrade head; poetry run fastapi run

View File

@ -3,7 +3,7 @@ import enum
import uuid
from typing import List, Optional
from pydantic import BaseModel, EmailStr
from pydantic import BaseModel, ConfigDict, EmailStr
class BaseResponse(BaseModel):
@ -13,5 +13,4 @@ class BaseResponse(BaseModel):
class User(BaseModel):
id: uuid.UUID
class Config:
orm_mode = True
model_config = ConfigDict(from_attributes=True, extra="ignore")

37
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,37 @@
services:
backend:
image: fastapi
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- JWT_SECRET=${JWT_SECRET}
- JWT_ALGORITHM=${JWT_ALGORITHM:-HS256}
- JWT_EXPIRE_MINUTES=${JWT_EXPIRE_MINUTES:-60}
- SQLALCHEMY_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- WAIT_HOSTS=db:5432
depends_on:
db:
condition: service_healthy
restart: unless-stopped
env_file:
- .env
db:
image: postgres:15.3
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- ./docker-data/postgres:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
env_file:
- .env

View File

@ -1,5 +1,3 @@
version: '3.1'
services:
backend:
image: fastapi
@ -12,13 +10,28 @@ services:
- JWT_SECRET=${JWT_SECRET}
- JWT_ALGORITHM=${JWT_ALGORITHM:-HS256}
- JWT_EXPIRE_MINUTES=${JWT_EXPIRE_MINUTES:-60}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- SQLALCHEMY_DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- WAIT_HOSTS=db:5432
depends_on:
- db
db:
condition: service_healthy
restart: unless-stopped
env_file:
- .env
db:
image: postgres:15.3
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
env_file:
- .env