This commit is contained in:
Pagwin 2026-06-17 16:26:06 -04:00
parent 751a0e2525
commit df0d42b2ec
3 changed files with 17 additions and 20 deletions

View file

@ -5,19 +5,19 @@ WORKDIR /app
# Install uv
RUN pip install --no-cache-dir uv
# Copy project files
# Install dependencies first (cached unless the lockfile changes)
COPY pyproject.toml uv.lock ./
# Install dependencies with uv
RUN uv sync --no-editable
RUN uv sync --frozen --no-install-project
# Copy source code
COPY solve.py web_solve.py ./
COPY templates/ templates/
COPY solve.py main.py index.html ./
# Set environment variables
ENV FLASK_APP=web_solve.py
ENV PYTHONUNBUFFERED=1
# Bind to all interfaces so the server is reachable outside the container
ENV HOST=0.0.0.0 \
PORT=8000 \
PYTHONUNBUFFERED=1
# Run Flask app
CMD ["uv", "run", "python", "web_solve.py"]
EXPOSE 8000
# Run the stdlib HTTP server
CMD ["uv", "run", "--frozen", "python", "main.py"]

View file

@ -1,14 +1,9 @@
version: '3.8'
services:
web:
build: .
ports:
- "5555:5000"
- "8000:8000"
environment:
- FLASK_ENV=development
- FLASK_DEBUG=1
volumes:
- .:/app
command: uv run python web_solve.py
- HOST=0.0.0.0
- PORT=8000
restart: unless-stopped

View file

@ -13,6 +13,7 @@ once, then calls it over the amounts it needs (0..max_resource) to build the
from __future__ import annotations
import json
import os
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
@ -58,7 +59,8 @@ class Handler(BaseHTTPRequestHandler):
def main():
host, port = "127.0.0.1", 8000
host = os.environ.get("HOST", "127.0.0.1")
port = int(os.environ.get("PORT", "8000"))
server = ThreadingHTTPServer((host, port), Handler)
print(f"Days Without Strife planner UI: http://{host}:{port}")
try: