Skip to content

Commit af8b316

Browse files
committed
fix: dependencies mis match
1 parent 566e8e7 commit af8b316

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

Dockerfile

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
FROM python:3.11-slim
22

3-
RUN apt update && apt install -y gcc build-essential
3+
# Install system dependencies
4+
RUN apt update && apt install -y gcc build-essential libpq-dev
45

6+
# Set working directory
57
WORKDIR /app
68

9+
# Copy the requirements file and install dependencies
710
COPY requirements.txt .
11+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
812

9-
RUN pip install --no-cache-dir -r requirements.txt
10-
13+
# Copy the rest of the application code
1114
COPY . .
1215

16+
# Expose port 8000 to allow access to FastAPI
1317
EXPOSE 8000
1418

15-
CMD ["fastapi", "run", "src"]
19+
# Run the FastAPI application using Uvicorn
20+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]

docker-compose.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
version: "3"
2-
31
services:
42
app:
53
build: .
64
ports:
75
- "8000:8000"
6+
depends_on:
7+
- db
8+
environment:
9+
- DATABASE_URL=postgresql://user:password@db:5432/database
810

9-
caddy:
10-
image: caddy:2
11-
ports:
12-
- "80:80"
13-
- "443:443"
11+
db:
12+
image: postgres
13+
environment:
14+
- POSTGRES_USER=user
15+
- POSTGRES_PASSWORD=password
16+
- POSTGRES_DB=database
1417
volumes:
15-
- ./Caddyfile:/etc/caddy/Caddyfile
16-
- caddy_data:/data
17-
- caddy_config:/config
18+
- db-data:/var/lib/postgresql/data
1819

1920
volumes:
20-
caddy_data:
21-
caddy_config:
21+
db-data:

requirements.txt

-1.24 KB
Binary file not shown.

scripts/test_app.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class Strategy(str, Enum):
1212

1313
user_data = {"email": "testuser@example.com", "password": "testpassword"}
1414

15+
api_user_data = {"email": "string", "password": "string"}
16+
1517
hospitals_data = [
1618
{
1719
"name": "Rajkot hospital",
@@ -88,10 +90,16 @@ class Strategy(str, Enum):
8890
def setup_test_environment():
8991
print("Setting up test environment...")
9092

93+
# Register and login
94+
response = httpx.post(f"{API_URL}/register", json=api_user_data)
95+
if response.status_code != 201:
96+
raise Exception(f"Failed to register api user: {response.text}")
97+
print("API User registered successfully")
98+
9199
# Register and login
92100
response = httpx.post(f"{API_URL}/register", json=user_data)
93101
if response.status_code != 201:
94-
raise Exception(f"Failed to register user: {response.text}")
102+
raise Exception(f"Failed to register normal user: {response.text}")
95103
print("User registered successfully")
96104

97105
response = httpx.post(f"{API_URL}/login", json=user_data)

0 commit comments

Comments
 (0)