FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 WORKDIR /app RUN pip install --no-cache-dir pipenv COPY Pipfile Pipfile.lock ./ RUN pipenv install --system --deploy COPY src ./src COPY lib ./lib RUN mkdir -p src/static/bundled-lib && cp -f lib/*.py src/static/bundled-lib/ COPY workspace ./workspace # Mirror canonical demo files into the static bundle so the editor's # "Reset demos" button works from a static-only host too. RUN mkdir -p src/static/bundled-demos && \ for f in pattern_rainbow_demo.py pattern_twinkle_demo.py pattern_chase_demo.py \ adc_slider_demo.py pin_demo.py serial_demo.py; do \ cp -f "workspace/code/$f" "src/static/bundled-demos/$f"; \ done EXPOSE 8080 CMD ["uvicorn", "app:app", "--app-dir", "src", "--host", "0.0.0.0", "--port", "8080"]