comit
Browse files- Dockerfile +11 -10
- requirements.txt +3 -0
- services/population.py +1 -1
- utils/logger.py +1 -1
Dockerfile
CHANGED
|
@@ -1,16 +1,17 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy all the files into the container
|
| 8 |
+
COPY . /app
|
|
|
|
| 9 |
|
| 10 |
+
# Install required Python packages
|
| 11 |
+
RUN pip install --no-cache-dir fastapi uvicorn pandas pydantic
|
| 12 |
|
| 13 |
+
# Expose the port FastAPI runs on
|
| 14 |
+
EXPOSE 7860
|
| 15 |
|
| 16 |
+
# Command to run the application
|
| 17 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
requirements.txt
CHANGED
|
@@ -1,3 +1,6 @@
|
|
| 1 |
fastapi[standard]
|
| 2 |
pandas
|
|
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
| 1 |
fastapi[standard]
|
| 2 |
pandas
|
| 3 |
+
uvicorn
|
| 4 |
+
pydantic
|
| 5 |
+
|
| 6 |
|
services/population.py
CHANGED
|
@@ -11,7 +11,7 @@ from population.utils.logger import logger
|
|
| 11 |
from fastapi import HTTPException
|
| 12 |
from population.models.schemas import ContinentPopulationResponse, CountryPopulation
|
| 13 |
|
| 14 |
-
file_path = "D:/
|
| 15 |
|
| 16 |
# Load the CSV file
|
| 17 |
try:
|
|
|
|
| 11 |
from fastapi import HTTPException
|
| 12 |
from population.models.schemas import ContinentPopulationResponse, CountryPopulation
|
| 13 |
|
| 14 |
+
file_path = "D:/backapp/world_population.csv"
|
| 15 |
|
| 16 |
# Load the CSV file
|
| 17 |
try:
|
utils/logger.py
CHANGED
|
@@ -2,7 +2,7 @@ import logging
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Ensure the 'logs' directory exists
|
| 5 |
-
log_dir = "D:/
|
| 6 |
os.makedirs(log_dir, exist_ok=True)
|
| 7 |
|
| 8 |
# Configure logging
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Ensure the 'logs' directory exists
|
| 5 |
+
log_dir = "D:/backapp/population/logs"
|
| 6 |
os.makedirs(log_dir, exist_ok=True)
|
| 7 |
|
| 8 |
# Configure logging
|