Skip to content

Commit 1f9c078

Browse files
committed
chore(docker): run full stack with compose and document startup flow
Start API and frontend services from docker compose with published ports. Update Make targets and Docker docs for the 3-container setup.
1 parent 2853286 commit 1f9c078

4 files changed

Lines changed: 48 additions & 8 deletions

File tree

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help build up down logs shell exec pull-model test clean fireform
1+
.PHONY: help build up down logs shell exec pull-model test clean fireform logs-app logs-ollama logs-frontend super-clean
22

33
help:
44
@printf '%s\n' \
@@ -16,6 +16,9 @@ help:
1616
@echo "make up - Start all containers"
1717
@echo "make down - Stop all containers"
1818
@echo "make logs - View container logs"
19+
@echo "make logs-app - View API container logs"
20+
@echo "make logs-frontend - View frontend container logs"
21+
@echo "make logs-ollama - View Ollama container logs"
1922
@echo "make shell - Open Python shell in app container"
2023
@echo "make exec - Execute Python script in container"
2124
@echo "make pull-model - Pull Mistral model into Ollama"
@@ -45,6 +48,9 @@ logs-app:
4548
logs-ollama:
4649
docker compose logs -f ollama
4750

51+
logs-frontend:
52+
docker compose logs -f frontend
53+
4854
shell:
4955
docker compose exec app /bin/bash
5056

container-init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ echo "============================================"
1616
make up
1717
echo "============================================"
1818
echo "Use make down to stop"
19-
echo "Use docker ps to verify, you should see 2 containers:"
19+
echo "Use docker ps to verify, you should see 3 containers:"
2020
echo "\t* fireform-app"
21+
echo "\t* fireform-frontend"
2122
echo "\t* ollama/ollama:latest"
2223
docker ps
2324
echo "============================================"
@@ -26,4 +27,3 @@ echo "============================================"
2627
make pull-model
2728
echo "============================================"
2829
echo "Done"
29-

docker-compose.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,32 @@ services:
2323
depends_on:
2424
ollama:
2525
condition: service_healthy
26+
command: /bin/sh -c "python3 -m api.db.init_db && python3 -m uvicorn api.main:app --host 0.0.0.0 --port 8000"
2627
volumes:
2728
- .:/app
29+
ports:
30+
- "8000:8000"
2831
environment:
2932
- PYTHONUNBUFFERED=1
3033
- PYTHONPATH=/app/src
3134
- OLLAMA_HOST=http://ollama:11434
3235
networks:
3336
- fireform-network
34-
stdin_open: true
35-
tty: true
37+
38+
frontend:
39+
image: python:3.11-slim
40+
container_name: fireform-frontend
41+
working_dir: /app
42+
command: python3 -m http.server 5173 --directory frontend
43+
volumes:
44+
- .:/app
45+
ports:
46+
- "5173:5173"
47+
depends_on:
48+
app:
49+
condition: service_started
50+
networks:
51+
- fireform-network
3652

3753
volumes:
3854
ollama_data:

docs/docker.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Docker documentation for FireForm
22

33
## Setup
4-
We will be using 2 different containers:
5-
1. `fireform-app` -> This container will hold the whole project itself.
6-
2. `ollama/ollama:latest` -> This is to deploy ollama, that way it's faster to set up.
4+
We will be using 3 containers:
5+
1. `fireform-app` -> Runs the FastAPI server on `http://127.0.0.1:8000`.
6+
2. `fireform-frontend` -> Serves the frontend on `http://127.0.0.1:5173`.
7+
3. `ollama/ollama:latest` -> Runs Ollama for LLM calls.
78

89
### Initial configuration steps
910
For this I provided a script that can be run to automate the setup.
@@ -46,6 +47,23 @@ make clean # Remove all containers and volumes
4647
```
4748
* You can see this list at any time by running `make help`.
4849

50+
## Running the full stack
51+
52+
```bash
53+
make build
54+
make up
55+
```
56+
57+
Then open:
58+
- Frontend: `http://127.0.0.1:5173`
59+
- API docs: `http://127.0.0.1:8000/docs`
60+
61+
If this is your first run, pull the model once:
62+
63+
```bash
64+
make pull-model
65+
```
66+
4967
## Debugging
5068
For debugging with LLMs it's really useful to attach the logs.
5169
* You can obtain the logs using `make logs` or `docker compose logs`.

0 commit comments

Comments
 (0)