Image Upload & Thumbnails Tutorial · Module 11 of 11

Capstone & Production Deployment

Ship the service: containerize, set up CI/CD, deploy to production, write runbooks, and document everything. By the end, your image upload service is battle-tested, well-documented, and ready for real users at scale.

~6–8 hrsAdvancedOperations focus
← Back to Module 11 overview
What You'll Have at the End

Definition of Done

  • Multi-stage Dockerfile: dev, build, prod with minimal final image.
  • docker-compose.yml for local development with all services.
  • GitHub Actions CI/CD: lint, test, build, push, deploy.
  • Deployment guide for production platform (Fly.io, AWS, etc).
  • On-call runbook: handling upload failures, thumbnail queue backlog, S3 issues, disk space.
  • SLO document: 99.9% of uploads complete within 5 seconds.
  • Capacity planning guide with growth milestones.
  • Polished README with architecture diagram and API examples.
The Steps

Build It

STEP 1

Create production Dockerfile

Create Dockerfile:

# Build stage
FROM node:20-alpine as builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Final stage
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package*.json ./

ENV NODE_ENV=production
EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD node -e "require('http').get('http://localhost:3000/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"

CMD ["node", "dist/index.js"]