DOCKER.md
This document describes the Docker configuration for the axios-docs project.
# Build and run the production container
docker compose up prod
# Or build separately
docker compose build prod
docker compose up -d prod
# Run development container with hot reload
docker compose up dev
┌─────────────────────────────────────────────────────────┐
│ Multi-Stage Build │
├─────────────────────────────────────────────────────────┤
│ Stage 1: Builder │
│ ├── node:20-alpine │
│ ├── Install dependencies │
│ └── Build static site → /app/public │
├─────────────────────────────────────────────────────────┤
│ Stage 2: Production │
│ ├── nginx:alpine │
│ ├── Copy static files from builder │
│ └── Serve on port 8080 │
├─────────────────────────────────────────────────────────┤
│ Stage 3: Development │
│ ├── node:20-alpine │
│ ├── Volume mounts for live editing │
│ └── http-server on port 8080 │
└─────────────────────────────────────────────────────────┘
| File | Purpose |
|---|---|
Dockerfile | Multi-stage build configuration |
.dockerignore | Excludes files from build context |
docker-compose.yml | Service orchestration |
docker/nginx.conf | Production nginx configuration |
appuser (UID 1001)server_tokens offunless-stopped for production# Build all stages
docker compose build
# Build specific stage
docker build --target production -t axios-docs:prod .
docker build --target development -t axios-docs:dev .
# Production
docker compose up prod
docker run -p 8080:8080 axios-docs:prod
# Development (with volume mounts)
docker compose up dev
# Shell into running container
docker exec -it axios-docs-prod sh
# View logs
docker compose logs -f prod
# Check health
docker inspect --format='{{.State.Health.Status}}' axios-docs-prod
The development container supports:
| Variable | Default | Description |
|---|---|---|
NODE_ENV | development | Node environment |
| Service | Internal | External (default) |
|---|---|---|
| Production | 8080 | 8080 |
| Development | 8080 | 8080 |
| Host Path | Container Path | Purpose |
|---|---|---|
. | /app | Source files |
| (anonymous) | /app/node_modules | Preserve container deps |