Backend (Fastify + TS): FluentForms webhook -> NocoDB row + QR + MailerSend email; PIN auth; scan/lookup/redeem with per-code serialization; reusable QR codes with count-based check-in; admin search. App (Expo, one codebase): Android APK + iPhone PWA. Login, camera scanner (native + web barcode-detector split), green/red overlay with sound + haptics, admin lookup/redeem. Session token persisted per device. Ops: multi-stage Dockerfile serving API + PWA same-origin, compose bound to 127.0.0.1; Forgejo Actions runner + tag-triggered signed APK build for Obtainium. Docs in README.md and INSTALL.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- Stage 1: build the Expo web (PWA) bundle ----
|
|
FROM node:22-bookworm AS web
|
|
WORKDIR /app
|
|
COPY app/package.json app/package-lock.json* ./
|
|
RUN npm install --no-audit --no-fund
|
|
COPY app/ ./
|
|
# Native app calls the public host; web build is same-origin so this is unused there.
|
|
ENV EXPO_PUBLIC_API_URL=https://scan.beartariacampgrounds.com
|
|
RUN npx expo export --platform web && node scripts/inject-pwa.mjs dist
|
|
|
|
# ---- Stage 2: build the backend ----
|
|
FROM node:22-bookworm AS backend
|
|
WORKDIR /srv
|
|
COPY backend/package.json backend/package-lock.json* ./
|
|
RUN npm install --no-audit --no-fund
|
|
COPY backend/tsconfig.json ./
|
|
COPY backend/src ./src
|
|
RUN npm run build
|
|
|
|
# ---- Stage 3: production dependencies only ----
|
|
FROM node:22-bookworm-slim AS runtime
|
|
ENV NODE_ENV=production
|
|
WORKDIR /srv
|
|
COPY backend/package.json backend/package-lock.json* ./
|
|
RUN npm install --omit=dev --no-audit --no-fund && npm cache clean --force
|
|
|
|
COPY --from=backend /srv/dist ./dist
|
|
COPY --from=web /app/dist ./web
|
|
ENV WEB_DIR=/srv/web
|
|
ENV PORT=8080
|
|
ENV HOST=0.0.0.0
|
|
|
|
# Run as the non-root node user shipped in the base image.
|
|
RUN chown -R node:node /srv
|
|
USER node
|
|
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD node -e "fetch('http://localhost:'+ (process.env.PORT||8080) +'/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
|
|
|
|
CMD ["node", "dist/server.js"]
|