Add Docker deployment with bundled data
This commit is contained in:
1 parent
1d45def80f
commit
201e3a5134
4 files changed
+72
No files matched your search
@@ -0,0 +1,14 @@
|
||||
.git/
|
||||
.venv/
|
||||
.venv-temp/
|
||||
.deps/
|
||||
**/__pycache__/
|
||||
*.py[cod]
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
tests/
|
||||
tmp*/
|
||||
data/cache/
|
||||
data/portfolio/*.sqlite3-shm
|
||||
data/portfolio/*.sqlite3-wal
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --gid 10001 primethai \
|
||||
&& useradd --uid 10001 --gid primethai --create-home --shell /usr/sbin/nologin primethai
|
||||
|
||||
COPY pyproject.toml README.md ./
|
||||
COPY primethai/ ./primethai/
|
||||
RUN python -m pip install --no-cache-dir .
|
||||
|
||||
COPY --chown=10001:10001 config/ ./config/
|
||||
COPY --chown=10001:10001 data/ ./data/
|
||||
COPY --chown=10001:10001 reports/ ./reports/
|
||||
|
||||
USER 10001:10001
|
||||
|
||||
EXPOSE 18900
|
||||
|
||||
ENTRYPOINT ["python", "-m", "primethai", "webui"]
|
||||
CMD ["--host", "0.0.0.0", "--port", "18900"]
|
||||
@@ -263,3 +263,15 @@ The cumulative daily ZIP is saved automatically as `data/raw/siamchart/set-archi
|
||||
The proposed limit reference is the latest EOD close, not a live quote or a guaranteed fill. Signal entries use that close as an estimate until you edit the ledger with the actual fill. The app does not connect to a broker, transmit orders, or automatically reconcile broker holdings. The backtest page is a research simulation, not a validated live record, and does not model market impact, bid/ask spreads, every corporate action, or broker-specific buying power. Verify current quotes, liquidity, order size and cash with the broker before each order.
|
||||
|
||||
The default dashboard report is written to `reports/primary_union_current`. You can change the local port, date range, starting cash, report folder, or input archives with `--port`, `--start`, `--initial-equity`, `--report-dir`, and `--archives`.
|
||||
|
||||
### Docker deployment
|
||||
|
||||
The Docker image includes the existing `data/` tree (SiamChart archives, imported daily prices, backtest inputs and the initial portfolio database) and `reports/`. It does not need to download the historical archives again. The app still checks for the latest daily EOD session and refreshes it automatically when needed.
|
||||
|
||||
Create `.env` from `.env.example` and set the login credentials and session secret as described above. Then build and start the app:
|
||||
|
||||
```powershell
|
||||
docker compose up --build -d
|
||||
```
|
||||
|
||||
Compose uses named volumes for `/app/data` and `/app/reports`. On first creation, Docker seeds them from the files included in the image; later restarts and image rebuilds keep the server's updated price archive, portfolio database and reports. Use `docker compose down` to stop the app while keeping its data. The port is bound to localhost so an HTTPS reverse proxy can sit in front of it.
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
primethai:
|
||||
build:
|
||||
context: .
|
||||
image: primethai:local
|
||||
init: true
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "127.0.0.1:18900:18900"
|
||||
volumes:
|
||||
- primethai-data:/app/data
|
||||
- primethai-reports:/app/reports
|
||||
|
||||
volumes:
|
||||
primethai-data:
|
||||
primethai-reports:
|
||||
Reference in new issue
Block a user