feat: modernize application — source, platform artifacts, CI/CD
All checks were successful
Build and Publish TechDocs / build-and-publish (push) Successful in 55s

- chore: ingest source code

58 files from https://github.com/gothinkster/node-express-realworld-example-app
- feat: add platform deployment artifacts
- feat: add CI/CD workflow automation
This commit is contained in:
2026-08-03 21:13:27 +00:00
parent b80de68988
commit c740ad4b8d
12 changed files with 762 additions and 331 deletions

View File

@@ -1,24 +1,39 @@
# This file is generated by Nx.
#
# Build the docker image with `npx nx docker-build api`.
# Tip: Modify "docker-build" options in project.json to change docker build args.
#
# Run the container with `docker run -p 3000:3000 -t api`.
FROM docker.io/node:lts-alpine
ENV HOST=0.0.0.0
ENV PORT=3000
# Build stage - compile TypeScript with Nx esbuild
FROM node:20-bullseye-slim AS build
WORKDIR /app
RUN addgroup --system api && \
adduser --system -G api api
COPY package*.json ./
RUN npm install
COPY nx.json project.json tsconfig*.json ./
COPY src ./src
RUN DATABASE_URL=postgresql://x:x@localhost/placeholder npx prisma generate --schema=src/prisma/schema.prisma
RUN npx nx build api --configuration=production
# Runtime stage — Debian bullseye-slim ships OpenSSL 1.1 (required by Prisma 4.x)
FROM node:20-bullseye-slim
WORKDIR /app
RUN groupadd --system api && \
useradd --system -g api api
COPY --from=build /app/dist/api/ ./
# Copy Prisma generated native client (Debian OpenSSL 1.1 binary)
COPY --from=build /app/node_modules/.prisma ./node_modules/.prisma
# Copy @prisma/client package
COPY --from=build /app/node_modules/@prisma ./node_modules/@prisma
# Copy Prisma CLI so migrate/push can run
COPY --from=build /app/node_modules/prisma ./node_modules/prisma
COPY --from=build /app/node_modules/.bin/prisma ./node_modules/.bin/prisma
# Copy schema so Prisma can run migrations at startup
COPY --from=build /app/src/prisma ./src/prisma
RUN npm install --omit=dev --ignore-scripts 2>/dev/null || npm install --omit=dev
COPY dist/api api
RUN chown -R api:api .
USER api
# You can remove this install step if you build with `--bundle` option.
# The bundled output will include external dependencies.
RUN npm --prefix api --omit=dev -f install
EXPOSE 3000
CMD [ "node", "api" ]
CMD ["sh", "-c", "n=0; until node_modules/.bin/prisma migrate deploy --schema=src/prisma/schema.prisma; do n=$((n+1)); if [ $n -ge 30 ]; then echo migrate: giving up after $n attempts; exit 1; fi; echo migrate: database not ready, attempt $n of 30, retrying in 5s; sleep 5; done; exec node main.js"]