Commit
·
55512d8
1
Parent(s):
24f4709
adding the docker file
Browse files- docker.compose.prod.yml +60 -0
docker.compose.prod.yml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
# --- Application Services ---
|
| 3 |
+
redis:
|
| 4 |
+
image: redis:7-alpine
|
| 5 |
+
# In production, you wouldn't typically expose the Redis port to the public internet.
|
| 6 |
+
# The other containers can still talk to it over the internal Docker network.
|
| 7 |
+
# ports:
|
| 8 |
+
# - "6379:6379"
|
| 9 |
+
restart: always
|
| 10 |
+
|
| 11 |
+
backend:
|
| 12 |
+
build:
|
| 13 |
+
context: .
|
| 14 |
+
dockerfile: ./backend/Dockerfile
|
| 15 |
+
ports:
|
| 16 |
+
# We expose port 8000 for external traffic
|
| 17 |
+
- "8000:8000"
|
| 18 |
+
# VOLUMES REMOVED: The code is now baked into the image. No hot-reloading needed.
|
| 19 |
+
# volumes:
|
| 20 |
+
# - ./backend:/code/app
|
| 21 |
+
env_file:
|
| 22 |
+
- .env
|
| 23 |
+
# COMMAND CHANGED: We use a production-grade server like Gunicorn instead of Uvicorn's dev server.
|
| 24 |
+
# The '--reload' flag is removed.
|
| 25 |
+
command: python -m gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:8000
|
| 26 |
+
restart: always
|
| 27 |
+
depends_on:
|
| 28 |
+
- redis
|
| 29 |
+
|
| 30 |
+
worker:
|
| 31 |
+
build:
|
| 32 |
+
context: .
|
| 33 |
+
dockerfile: ./backend/Dockerfile
|
| 34 |
+
# VOLUMES REMOVED: The worker also uses the code baked into the image.
|
| 35 |
+
# volumes:
|
| 36 |
+
# - ./backend:/code/app
|
| 37 |
+
env_file:
|
| 38 |
+
- .env
|
| 39 |
+
command: python -m celery -A celery_worker.celery worker --loglevel=info
|
| 40 |
+
restart: always
|
| 41 |
+
depends_on:
|
| 42 |
+
- redis
|
| 43 |
+
- backend
|
| 44 |
+
|
| 45 |
+
frontend:
|
| 46 |
+
build:
|
| 47 |
+
context: .
|
| 48 |
+
# We would use a multi-stage Dockerfile that builds the static files
|
| 49 |
+
# and serves them with a production server like Nginx.
|
| 50 |
+
dockerfile: ./frontend/Dockerfile.prod
|
| 51 |
+
ports:
|
| 52 |
+
# The production frontend is served on the standard HTTP port 80.
|
| 53 |
+
- "80:80"
|
| 54 |
+
# VOLUMES REMOVED: The static files are baked into the image.
|
| 55 |
+
# volumes:
|
| 56 |
+
# - ./frontend:/app
|
| 57 |
+
# - /app/node_modules
|
| 58 |
+
restart: always
|
| 59 |
+
depends_on:
|
| 60 |
+
- backend
|