Existing accounts (including admin) seeded before new demos shipped had no easy way to pull in the latest copies — the registration-time seeder is intentionally non-destructive. The new badge action fetches src/static/bundled-demos/manifest.json, confirms the overwrite, and re-copies each canonical demo into code/. Open tabs of those files are refreshed in place so the user sees the new content immediately. src/static/bundled-demos/ ships the six canonical files plus the manifest so this works in local mode and on a static-only host. The Dockerfile now mirrors workspace/code/<demo>.py into bundled-demos/ during the image build, keeping the two locations in sync. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
855 B
Docker
29 lines
855 B
Docker
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"]
|