Updated code for Flask API container
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| FROM python:3.11.7-slim-bookworm | ||||
| WORKDIR /app | ||||
| COPY src . | ||||
| COPY api . | ||||
| RUN pip install -r requirements.txt | ||||
| CMD python3 app.py | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import os | ||||
| if __name__ == "__main__": | ||||
|     load_dotenv() | ||||
|     app = Flask(__name__) | ||||
|     app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URI') | ||||
|     app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('SQLALCHEMY_DATABASE_URI') | ||||
|     app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True | ||||
|     app.config['JWT_SECRET_KEY'] = 'changeme' | ||||
|     app.register_blueprint(user_bp) | ||||
|   | ||||
| @@ -1,11 +1,13 @@ | ||||
| blinker==1.7.0 | ||||
| click==8.1.7 | ||||
| Flask==3.0.0 | ||||
| Flask-JWT-Extended==4.7.1 | ||||
| Flask-SQLAlchemy==3.1.1 | ||||
| greenlet==3.0.1 | ||||
| itsdangerous==2.1.2 | ||||
| Jinja2==3.1.2 | ||||
| MarkupSafe==2.1.3 | ||||
| mysql-connector-python==9.2.0 | ||||
| python-dotenv==1.0.0 | ||||
| SQLAlchemy==2.0.23 | ||||
| typing_extensions==4.8.0 | ||||
|   | ||||
| @@ -1,13 +1,17 @@ | ||||
| version: '3.7' | ||||
|  | ||||
| services: | ||||
|   web: | ||||
|   api: | ||||
|     container_name: todo-api | ||||
|     hostname: todo-api | ||||
|     build: . | ||||
|     env_file: | ||||
|       - src/.env | ||||
|       - api/.env | ||||
|     ports: | ||||
|       - "5000:5000" | ||||
|     volumes: | ||||
|       - ./src/test.db:/app/test.db | ||||
|     #volumes: | ||||
|       #- ./api/test.db:/app/test.db | ||||
|   db: | ||||
|     container_name: db | ||||
|     hostname: db | ||||
|     image: mysql:latest | ||||
|     env_file: | ||||
|       - db/.env | ||||
|   | ||||
		Reference in New Issue
	
	Block a user