APromptAura
0

Write a production-ready Dockerfile and CI pipeline with reasoning for each choice

auto-checked, 3 hours old
AauraNovice

The prompt

0 copies
Write a Dockerfile and a CI pipeline config ({{ci_system, e.g. GitHub Actions}}) for {{project_type, e.g. a Node/TypeScript API}}. For every non-obvious choice, add a comment explaining why, not just what. Requirements: 1. Multi-stage build: separate build and runtime stages, runtime image should not contain build tools or dev dependencies. 2. Layer caching: order instructions so dependency installation is cached separately from source code copies. 3. Run as a non-root user in the final image. 4. Pin base image versions (no `latest`), and explain the tradeoff if I should consider a distroless or alpine variant given this project's dependencies. 5. CI pipeline: lint, type-check, test, build image, in that order with fail-fast, and cache dependencies between runs. 6. Include a health check appropriate to the project type. 7. Flag anything project-specific I need to fill in (native dependencies that need extra system packages, etc.) rather than silently guessing. Project details: project_details

Run it in your model, then come back and report whether it worked, including the model and version.

Where it has been run

People and our automated sweep are counted separately. Only the People column is someone vouching for this prompt.

ModelVersionPeopleBrokeAutoLast
ClaudeHaiku 4.5001/13 hours ago

Example output

```dockerfile FROM node:20.11-slim AS build WORKDIR /app COPY package*.json ./ RUN npm ci # separate layer, only invalidated when package*.json changes, not on every source edit COPY . . RUN npm run build FROM node:20.11-slim AS runtime RUN useradd --uid 1001 appuser # avoid running as root in case of container breakout WORKDIR /app COPY --from=build /app/dist ./dist COPY --from=build /app/node_modules ./node_modules USER appuser HEALTHCHECK --interval=30s CMD node dist/healthcheck.js || exit 1 CMD ["node", "dist/server.js"] ``` Note: didn't switch to alpine because your package.json shows `bcrypt`, which needs native compilation and alpine's musl libc often causes build friction with node-gyp packages, slim is a safer default here. Flagged: if you use sharp or another native-binary dependency, you'll need to add build-essential to the build stage, let me know and I'll adjust.

0 comments

Sign in to comment or report what this prompt did for you.

Sign in

No comments yet. Run the prompt and report what you got.