|
| 1 | +# Docker Image Guidelines |
| 2 | + |
| 3 | +This document outlines the Docker build strategy for the React Router Nest application. |
| 4 | + |
| 5 | +## Multi-Architecture Support |
| 6 | + |
| 7 | +Our Docker images are built and published with support for multiple architectures: |
| 8 | + |
| 9 | +- `linux/amd64` (x86_64) - For standard x86-based servers |
| 10 | +- `linux/arm64` (aarch64) - For ARM-based servers, including AWS Graviton, Apple Silicon, and many cloud ARM instances |
| 11 | + |
| 12 | +This multi-architecture approach eliminates the need for emulation and provides native performance on all supported platforms. |
| 13 | + |
| 14 | +## Build Process |
| 15 | + |
| 16 | +The Docker images are built automatically through GitHub Actions when a new version tag is pushed: |
| 17 | + |
| 18 | +1. The workflow in `.github/workflows/release-tag.yml` is triggered on tag push matching `v*.*.*` pattern |
| 19 | +2. The Docker Buildx action builds the images for multiple platforms |
| 20 | +3. Images are pushed to GitHub Container Registry (ghcr.io) |
| 21 | + |
| 22 | +## Image Tags |
| 23 | + |
| 24 | +- `ghcr.io/cbnsndwch/react-router-nest-server:latest` - Latest stable release |
| 25 | +- `ghcr.io/cbnsndwch/react-router-nest-server:v{x.y.z}` - Specific version (e.g., `v0.4.6`) |
| 26 | + |
| 27 | +## Local Multi-Architecture Builds |
| 28 | + |
| 29 | +If you need to build multi-architecture images locally: |
| 30 | + |
| 31 | +```bash |
| 32 | +# Set up Docker Buildx builder |
| 33 | +docker buildx create --name multiarch --use |
| 34 | + |
| 35 | +# Build and push |
| 36 | +docker buildx build --platform linux/amd64,linux/arm64 \ |
| 37 | + -t ghcr.io/cbnsndwch/react-router-nest-server:local \ |
| 38 | + -f apps/server/Dockerfile \ |
| 39 | + --push \ |
| 40 | + . |
| 41 | +``` |
| 42 | + |
| 43 | +## Deployment |
| 44 | + |
| 45 | +For information about deploying these images in a Docker Swarm environment, see the [Docker Stack documentation](.docker/README.md). |
| 46 | + |
| 47 | +## Best Practices |
| 48 | + |
| 49 | +1. **Base image selection**: We use the official Node Alpine images as they provide a good balance between size and functionality. |
| 50 | +2. **Multi-stage builds**: Our Dockerfile uses multi-stage builds to keep the final image small. |
| 51 | +3. **Layer caching**: We organize commands to maximize Docker layer caching. |
| 52 | +4. **Security**: We run the application as a non-root user where possible. |
| 53 | +5. **Metadata**: We apply appropriate OCI-compliant labels to our images. |
0 commit comments