Compare commits
6 Commits
loaf-prod
...
09712e52bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09712e52bb | ||
|
|
366245acc7 | ||
|
|
a75bf743f4 | ||
|
|
fb369977d0 | ||
|
|
1ed9aa0994 | ||
|
|
04783f66f1 |
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Use an official Python image (Linux)
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
# Set a working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy dependency list
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
# Copy the rest of the project
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Expose port (whatever your backend runs on)
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Run exactly your command
|
||||||
|
CMD ["python", "-m", "uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||||
Binary file not shown.
Binary file not shown.
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile # Use Dockerfile.prod for production
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: "{DATABASE_URL}"
|
||||||
|
volumes:
|
||||||
|
- .:/app # sync code for hot reload
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:15
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
POSTGRES_DB: dbname
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
pgdata:
|
||||||
Reference in New Issue
Block a user