datewise/Dockerfile
metatroncubeswdev bd2e3906df chore(deploy): Docker stack for the VPS (db, app, worker; Caddy or existing Nginx)
- multi-stage Dockerfile; worker bundled to build/worker.mjs (no tsx at runtime)
- docker-compose.yml + docker-compose.nginx.yml (127.0.0.1:3320), Nginx site, encrypted backups
- production URLs (datewise.metatronlabz.com) in shopify.app.toml; URL auto-update off
- verified locally: healthz/landing/privacy/terms 200, unsigned proxy/webhook 400, worker starts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:53:08 -04:00

29 lines
1.3 KiB
Docker

# Datewise web app (admin, app proxy, webhooks) and background worker (hold sweeps, reminders,
# order reconciliation) — one image, two processes. The Shopify extensions and functions are
# deployed separately with `shopify app deploy`.
FROM node:22-alpine AS build
RUN apk add --no-cache openssl
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# Build first, prune dev dependencies after (vite, esbuild and the type packages are needed to build).
RUN npx prisma generate \
&& npm run build \
&& npx esbuild app/jobs/worker.ts --bundle --platform=node --format=esm --packages=external --outfile=build/worker.mjs \
&& npm prune --omit=dev
FROM node:22-alpine
RUN apk add --no-cache openssl
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/package.json /app/package-lock.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/build ./build
COPY --from=build /app/public ./public
COPY --from=build /app/prisma ./prisma
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s CMD wget -qO- http://127.0.0.1:3000/healthz || exit 1
# Web (default): apply database migrations, then start. The worker service overrides this with `node build/worker.mjs`.
CMD ["sh", "-c", "npx prisma migrate deploy && npx react-router-serve ./build/server/index.js"]