chore(tooling): add Dockerfile first draft
+ 74
- 0
new file
.dockerignore
@@ -0,0 +1,23 @@
+.DS_Store
+dist/
+node_modules/
+
+package-lock.json
+*.log
+
+# Ignore built public files
+public/.islands/
+public/instant-router.js
+public/instant-router.js.map
+public/islands-runtime.js
+public/islands-runtime.js.map
+
+# Environment files (except examples)
+!.env
+!.env.example
+!.env.*.example
+.env.*
+
+# Local development sessions db
+*.db
+*.sqlite

@@ -0,0 +1,51 @@
+FROM node:alpine as builder
+
+ENV NODE_ENV=production
+ENV PORT=4100
+
+WORKDIR /app/build
+
+COPY ./patches        .
+COPY ./package.json   .
+COPY ./yarn.lock      .
+
+RUN yarn # Install dependencies
+
+COPY ./app      .
+COPY ./db       .
+COPY ./public   .
+COPY ./types    .
+
+COPY ./app.manifest.json   .
+COPY ./paths.ts            .
+COPY ./tsconfig.json       .
+
+COPY ReadMe.md   .
+COPY LICENSE     .
+
+RUN yarn typecheck         # Validate TS types are valid first
+RUN yarn clean             # Cleanup working dir
+RUN yarn generate:prisma   # Generate Prisma Client from schema (db/schema.prisma)
+RUN yarn build:ts          # Transpile TypeScript to JavaScript (node)
+RUN yarn bundle:islands    # Bundle Islands (react-monolith) to ESM/CJS/UMD
+
+# If everything went well, issue a git stamp file containing built commit hash.
+RUN echo "$(git rev-parse HEAD)" >> .gitstamp
+
+FROM node:slim as base
+
+ENV NODE_ENV=production
+ENV PORT=4100
+
+WORKDIR /app
+
+COPY --from=builder /app/build/.gitstamp      .
+COPY --from=builder /app/build/dist           .
+COPY --from=builder /app/build/node_modules   .
+COPY --from=builder /app/build/yarn.lock      .
+COPY --from=builder /app/build/ReadMe.md      .
+COPY --from=builder /app/build/LICENSE        .
+
+RUN echo "Running from Git commit: $(cat .gitstamp)"
+
+CMD ['node', 'app/server.js']