From 0313c2a2ae89dcfda41e95775778f69ae4b6fa3b Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 15 May 2025 07:43:17 +0000 Subject: [PATCH] Added docker file --- Dockerfile | 28 ++++++++++++++++++++++++++++ docker-compose.yml | 22 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..be2c14f1 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..013a91f6 --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file