Files
busbar-designer/Dockerfile
T
wenil d8cb0dc06d Initial commit: Busbar Designer
Web tool for designing nickel/copper busbars over cylindrical-cell battery
packs (21700, 18650) in hex holders. Flask + build123d backend exports
STEP/DXF/SVG; vanilla JS frontend with live preview, multi-project SQLite
persistence, snapshot history.

Deploy scripts in deploy/ (proxmox-lxc.sh, install.sh, update.sh).
2026-05-24 18:59:50 +03:00

51 lines
1.5 KiB
Docker

# Multi-stage to keep the runtime image small.
# build123d pulls scipy + matplotlib + OCP wheel — a few hundred MB.
FROM python:3.12-slim AS builder
ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libgl1 libglu1-mesa libxrender1 libxext6 libsm6 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --user -r requirements.txt && \
pip install --user gunicorn
# ---------------------------------------------------------------------------
FROM python:3.12-slim AS runtime
# OCP needs these at runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglu1-mesa libxrender1 libxext6 libsm6 libgomp1 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --shell /usr/sbin/nologin app
COPY --from=builder /root/.local /home/app/.local
ENV PATH=/home/app/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
HOST=0.0.0.0 \
PORT=5000 \
FLASK_DEBUG=0
WORKDIR /app
COPY --chown=app:app app.py busbar_export.py ./
COPY --chown=app:app static/ ./static/
USER app
EXPOSE 5000
# SQLite DB lives here; mount as a volume to persist across container restarts.
ENV BUSBAR_DB=/app/data/busbar.db
VOLUME /app/data
# 2 workers is plenty — each export is CPU-bound on OpenCASCADE; more workers
# don't help on a single-socket VM and just balloon RAM.
CMD ["gunicorn", "--bind=0.0.0.0:5000", "--workers=2", "--threads=2", \
"--timeout=120", "app:app"]