Files
ti/Dockerfile
Henrik Jess Nielsen b640d9950c feat(pwa): offline support so the list works in-store with no net
No signal inside the store made the server-rendered app unusable. Make it
an installable PWA:
- service worker (static/sw.js) caches pages (network-first, cache fallback)
  and assets, served from root so scope is /
- offline.js: cittiFetch() queues check-off / price / qty / pick POSTs in
  localStorage when offline and replays them in order on reconnect, with an
  optimistic response and an Offline/Syncing status badge
- manifest + icon for add-to-home-screen; PWA meta tags on the in-store pages
- in-store mutations (saveToServer, pick/unpick) go through cittiFetch;
  archive/refresh/add still need net by design
- Dockerfile copies static/
Open once online first so the SW can cache; then it works offline.
2026-10-30 11:54:38 +01:00

40 lines
834 B
Docker

FROM python:3.12-slim
ARG BUILD_VERSION=unknown
ARG BUILD_TIME=unknown
ARG GIT_COMMIT=unknown
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
FLASK_APP=app.py \
FLASK_ENV=production \
BUILD_VERSION=${BUILD_VERSION} \
BUILD_TIME=${BUILD_TIME} \
GIT_COMMIT=${GIT_COMMIT}
WORKDIR /app
# ca-certificates: urllib needs them to reach the Tjek API over HTTPS
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade --no-cache-dir pip
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
COPY templates/ templates/
COPY static/ static/
ENV DATA_DIR=/app/instance \
PORT=9756 \
HOST=0.0.0.0
RUN mkdir -p /app/instance
EXPOSE 9756
CMD ["sh", "-c", "python app.py"]