Added docker file

This commit is contained in:
erik 2025-05-15 07:43:17 +00:00
parent b94f064118
commit 0313c2a2ae
2 changed files with 50 additions and 0 deletions

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
# Dockerfile for Dereth Tracker application
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Upgrade pip and install Python dependencies
RUN python -m pip install --upgrade pip && \
pip install --no-cache-dir fastapi uvicorn pydantic pandas matplotlib websockets
# Copy application code
COPY static/ /app/static/
COPY main.py /app/main.py
COPY db.py /app/db.py
COPY Dockerfile /Dockerfile
# Expose the application port
EXPOSE 8765
# Default environment variables (override as needed)
ENV DB_MAX_SIZE_MB=2048 \
DB_RETENTION_DAYS=7 \
DB_MAX_SQL_LENGTH=1000000000 \
DB_MAX_SQL_VARIABLES=32766 \
DB_WAL_AUTOCHECKPOINT_PAGES=1000 \
SHARED_SECRET=your_shared_secret
# Run the FastAPI application with Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8765", "--reload", "--workers", "1"]

22
docker-compose.yml Normal file
View file

@ -0,0 +1,22 @@
version: "3.8"
services:
dereth-tracker:
build: .
ports:
- "127.0.0.1:8765:8765"
volumes:
# Mount local database file for persistence
- "./dereth.db:/app/dereth.db"
- "./main.py:/app/main.py"
- "./db.py:/app/db.py"
- "./static:/app/static"
environment:
# Override database and application settings as needed
DB_MAX_SIZE_MB: "2048"
DB_RETENTION_DAYS: "7"
DB_MAX_SQL_LENGTH: "1000000000"
DB_MAX_SQL_VARIABLES: "32766"
DB_WAL_AUTOCHECKPOINT_PAGES: "1000"
SHARED_SECRET: "your_shared_secret"
restart: unless-stopped