Skip to content

Commit 573cdca

Browse files
committed
ci: add Docker image guidelines and update README for Docker deployment instructions
1 parent 0174445 commit 573cdca

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

.github/DOCKER.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.

.github/workflows/release-tag.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
context: .
7373
file: apps/server/Dockerfile
7474
push: true
75+
platforms: linux/amd64,linux/arm64
7576
tags: ${{ steps.meta.outputs.tags }}
7677
labels: ${{ steps.meta.outputs.labels }}
7778
cache-from: type=gha

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ This demo shows how to leverage modern routing and server-side rendering from Re
3434
- Visit `http://localhost:4003` in your browser to view the application
3535
- Send a GET request to `http://localhost:4003/api/hello` to test the API
3636

37+
### Docker Deployment
38+
39+
The project includes Docker support with multi-architecture images (amd64/arm64):
40+
41+
- Docker images are published to GitHub Container Registry: `ghcr.io/cbnsndwch/react-router-nest-server`
42+
- A Docker Swarm stack configuration is available in `.docker/stack.yml`
43+
44+
For more information:
45+
- See [Docker Image Guidelines](.github/DOCKER.md) for details on the Docker images
46+
- See [Docker Stack Documentation](.docker/README.md) for deployment instructions
47+
3748
## Contributing
3849

3950
We welcome contributions from the community! Please consider the following:

0 commit comments

Comments
 (0)