mirror of
https://github.com/Chewbaccalakis/rfid-database.git
synced 2026-09-09 16:01:56 -07:00
RFID tag dump PWA + REST API (with Docker Compose) (#2)
* Implement RFID tag dump PWA with REST API, auth, and CI Add Next.js app with SQLite/Drizzle storage for sites and LF/HF tag dumps, multi-user Auth.js (credentials + optional OIDC), personal API tokens in Settings, versioned /api/v1 for UI and future CLI use, MCT/Proxmark/JSON import-export, PWA offline shell, Vitest tests, and GitHub Actions CI. * Add Docker Compose setup with persistent volume Improve the production Dockerfile (healthcheck, entrypoint bootstrap user, pruned deps) and add docker-compose.yml plus .dockerignore for one-command deploy with a named SQLite volume. --------- Co-authored-by: Cursor Agent <[email protected]>
This commit is contained in:
co-authored by
Cursor Agent
parent
8500d2f673
commit
d3ed4566b7
+46
@@ -2,18 +2,33 @@
|
||||
|
||||
FROM node:22-bookworm-slim AS deps
|
||||
WORKDIR /app
|
||||
<<<<<<< HEAD
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
=======
|
||||
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
|
||||
>>>>>>> origin/main
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
WORKDIR /app
|
||||
<<<<<<< HEAD
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
=======
|
||||
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
|
||||
>>>>>>> origin/main
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV AUTH_SECRET=build-time-placeholder-secret-32chars
|
||||
<<<<<<< HEAD
|
||||
RUN npm run build \
|
||||
&& npm prune --omit=dev
|
||||
=======
|
||||
RUN npm run build
|
||||
>>>>>>> origin/main
|
||||
|
||||
FROM node:22-bookworm-slim AS runner
|
||||
WORKDIR /app
|
||||
@@ -21,6 +36,36 @@ ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ENV RFID_DB_PATH=/data/rfid.db
|
||||
ENV PORT=3000
|
||||
<<<<<<< HEAD
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV AUTH_TRUST_HOST=true
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libstdc++6 curl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /data \
|
||||
&& chown node:node /data
|
||||
|
||||
COPY --from=builder --chown=node:node /app/package.json /app/package-lock.json ./
|
||||
COPY --from=builder --chown=node:node /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=node:node /app/.next ./.next
|
||||
COPY --from=builder --chown=node:node /app/public ./public
|
||||
COPY --from=builder --chown=node:node /app/scripts ./scripts
|
||||
COPY --from=builder --chown=node:node /app/src ./src
|
||||
COPY --from=builder --chown=node:node /app/tsconfig.json ./tsconfig.json
|
||||
# tsx is needed for create-user / entrypoint bootstrap (devDependency pruned above)
|
||||
RUN npm install --omit=dev [email protected] \
|
||||
&& chown -R node:node /app/node_modules
|
||||
COPY --chown=node:node docker/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
VOLUME ["/data"]
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD curl -fsS http://127.0.0.1:3000/login >/dev/null || exit 1
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
=======
|
||||
RUN apt-get update && apt-get install -y libstdc++6 && rm -rf /var/lib/apt/lists/*
|
||||
RUN mkdir -p /data && chown node:node /data
|
||||
COPY --from=builder /app/package.json /app/package-lock.json ./
|
||||
@@ -33,4 +78,5 @@ COPY --from=builder /app/tsconfig.json ./tsconfig.json
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
VOLUME ["/data"]
|
||||
>>>>>>> origin/main
|
||||
CMD ["npm", "run", "start"]
|
||||
|
||||
Reference in New Issue
Block a user