Compare commits
4 Commits
main
...
2c845dbdfd
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c845dbdfd | |||
| 78d578562e | |||
| bc36158de9 | |||
| 90ae2ea8e4 |
@ -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
|
||||
|
||||
@ -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
37
docker-compose.prod.yml
Normal 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
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user