First commit
commit
a3950a90bd
|
@ -0,0 +1,2 @@
|
|||
dockerfile
|
||||
docker-compose.yaml
|
|
@ -0,0 +1,5 @@
|
|||
FROM python:3.10.10-alpine3.17
|
||||
WORKDIR /app/
|
||||
COPY . /app/
|
||||
RUN pip3 install -r requirements.txt
|
||||
CMD ["uvicorn","sql_app.main:app","--host","0.0.0.0","--reload"]
|
|
@ -0,0 +1,11 @@
|
|||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
import os
|
||||
SQLALCHEMY_DATABASE_URL = os.getenv('DB_URL')
|
||||
# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
|
||||
|
||||
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
|
@ -0,0 +1,33 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
db:
|
||||
networks:
|
||||
- postgres
|
||||
image: postgres:15.2-alpine3.17
|
||||
environment:
|
||||
- POSTGRES_USER=capycode
|
||||
- POSTGRES_DB=estudio
|
||||
- POSTGRES_PASSWORD=capycode123
|
||||
expose:
|
||||
- "5432"
|
||||
api:
|
||||
networks:
|
||||
- postgres
|
||||
image: FastApi_estudio:0.0.1
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DB_URL=postgresql://capycode:capycode123@db:5432/estudio
|
||||
depends_on:
|
||||
- db
|
||||
pgadmin:
|
||||
networks:
|
||||
- postgres
|
||||
image: dpage/pgadmin4
|
||||
environment:
|
||||
- PGADMIN_DEFAULT_EMAIL=CapycodeUSM@gmail.com
|
||||
- PGADMIN_DEFAULT_PASSWORD=capycode123
|
||||
ports:
|
||||
- "3000:80"
|
||||
networks:
|
||||
postgres:
|
|
@ -0,0 +1,4 @@
|
|||
fastapi>=0.95.0
|
||||
uvicorn>=0.21.1
|
||||
sqlalchemy>=1.4.47
|
||||
psycopg2-binary
|
Loading…
Reference in New Issue