Spaces:
Runtime error
Runtime error
Commit
·
bfbdc91
0
Parent(s):
First setup commit
Browse files- Dockerfile +16 -0
- __pycache__/main.cpython-311.pyc +0 -0
- docker-compose.yml +58 -0
- frontend +1 -0
- main.py +7 -0
- requirements.txt +10 -0
Dockerfile
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.11-slim
|
2 |
+
|
3 |
+
# Set the working directory in the container
|
4 |
+
WORKDIR /app
|
5 |
+
|
6 |
+
# Copy the requirements.txt from the backend folder to the container
|
7 |
+
COPY requirements.txt .
|
8 |
+
|
9 |
+
# Install the dependencies specified in requirements.txt
|
10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
11 |
+
|
12 |
+
# Copy the application code (main.py) into the container
|
13 |
+
COPY main.py /app/main.py
|
14 |
+
|
15 |
+
# Command to run the FastAPI app
|
16 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
__pycache__/main.cpython-311.pyc
ADDED
Binary file (439 Bytes). View file
|
|
docker-compose.yml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# version: '3.10.11'
|
2 |
+
|
3 |
+
services:
|
4 |
+
map-wikiread:
|
5 |
+
build:
|
6 |
+
context: .
|
7 |
+
dockerfile: Dockerfile # Use the Dockerfile in the current directory
|
8 |
+
ports:
|
9 |
+
- "8004:8000" # Expose port 8004 on host to port 8000 in the container
|
10 |
+
command: uvicorn main:app --host 0.0.0.0 --reload
|
11 |
+
# command: /bin/sh -c "pip install -r requirements.txt && uvicorn main:app --host 0.0.0.0 --reload"
|
12 |
+
environment:
|
13 |
+
- MONGODB_URL=mongodb://mongodb-wikiread:27017
|
14 |
+
- DATABASE_NAME=wikiread
|
15 |
+
volumes:
|
16 |
+
- .:/app # Mount the current directory to /app in the container
|
17 |
+
depends_on:
|
18 |
+
- mongodb-wikiread # Ensure MongoDB starts before the backend
|
19 |
+
networks:
|
20 |
+
- wikiread_network
|
21 |
+
|
22 |
+
mongodb-wikiread:
|
23 |
+
image: mongo:latest
|
24 |
+
ports:
|
25 |
+
- "27017:27017" # Expose MongoDB on port 27017. Decided not to use another port.
|
26 |
+
container_name: mongodb-wikiread
|
27 |
+
environment:
|
28 |
+
- MONGO_INITDB_ROOT_USERNAME=user
|
29 |
+
- MONGO_INITDB_ROOT_PASSWORD=root
|
30 |
+
volumes:
|
31 |
+
- mongodb_data:/data/db # Use a volume for persistent MongoDB data
|
32 |
+
networks:
|
33 |
+
- wikiread_network
|
34 |
+
|
35 |
+
|
36 |
+
frontend:
|
37 |
+
build:
|
38 |
+
context: ./frontend
|
39 |
+
dockerfile: Dockerfile
|
40 |
+
ports:
|
41 |
+
- "3000:3000"
|
42 |
+
volumes:
|
43 |
+
- ./frontend:/app
|
44 |
+
- /app/node_modules
|
45 |
+
environment:
|
46 |
+
- REACT_APP_API_URL=http://localhost:8004
|
47 |
+
depends_on:
|
48 |
+
- map-wikiread
|
49 |
+
networks:
|
50 |
+
- wikiread_network
|
51 |
+
|
52 |
+
networks:
|
53 |
+
wikiread_network:
|
54 |
+
driver: bridge # Create a bridge network to connect the backend and MongoDB
|
55 |
+
|
56 |
+
volumes:
|
57 |
+
mongodb_data:
|
58 |
+
driver: local
|
frontend
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 13a1feb728bfc120be942f858677bf73a1e9827a
|
main.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
app = FastAPI()
|
4 |
+
|
5 |
+
@app.get("/")
|
6 |
+
def health_check():
|
7 |
+
return {"status": "ok"}
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
uvicorn == 0.34.0
|
2 |
+
fastapi[all] == 0.115.6
|
3 |
+
pymongo == 4.10.0
|
4 |
+
python-dotenv == 1.0.1
|
5 |
+
python-dateutil == 2.9.0.post0
|
6 |
+
passlib == 1.7.4
|
7 |
+
pyjwt == 2.9.0
|
8 |
+
pytest == 8.3.4
|
9 |
+
geopy == 2.4.1
|
10 |
+
gpxpy == 1.6.2
|