Skip to content

Commit ea3da19

Browse files
committed
docs: update Docker documentation to reflect simplified setup
- Removed multi-stage Dockerfile complexity - Updated documentation to match single Dockerfile approach - Both dev and prod modes use 'yarn snapp start' - Development uses volume mounts for hot reload - Production uses built-in code without volumes - Simplified and cleaner Docker setup
1 parent 93f9152 commit ea3da19

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed

DOCKER.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Docker Setup for SenseNet Client
2+
3+
This guide explains how to run the SenseNet client application using Docker.
4+
5+
## 🚀 Quick Start
6+
7+
### Development (with hot reload)
8+
```bash
9+
docker-compose -f docker-compose.dev.yml up -d
10+
```
11+
- **URL**: http://localhost:8080
12+
- **Hot reload**: ✅ File changes are instantly reflected
13+
- **Use case**: Active development
14+
15+
### Production
16+
```bash
17+
docker-compose -f docker-compose.prod.yml up -d
18+
```
19+
- **URL**: http://localhost:8080
20+
- **Hot reload**: ❌ Static built files
21+
- **Use case**: Testing production builds, deployment
22+
23+
## 📁 Files Overview
24+
25+
| File | Purpose |
26+
|------|---------|
27+
| `Dockerfile` | Single Docker image for both dev and prod |
28+
| `docker-compose.dev.yml` | Development setup with volume mounts |
29+
| `docker-compose.prod.yml` | Production setup without volume mounts |
30+
| `.dockerignore` | Excludes unnecessary files from build context |
31+
32+
## 🔧 How It Works
33+
34+
### Development Mode
35+
- **Volume mounting**: Your local code is mounted into the container
36+
- **File watching**: Changes trigger automatic rebuilds
37+
- **Command**: `yarn snapp start` (webpack dev server with hot reload)
38+
39+
### Production Mode
40+
- **Built files**: Uses pre-built static files inside the container
41+
- **No volumes**: Container is self-contained
42+
- **Command**: `yarn snapp start` (same command, but runs webpack dev server on built files)
43+
44+
## 🛠️ Common Commands
45+
46+
```bash
47+
# Start development
48+
docker-compose -f docker-compose.dev.yml up -d
49+
50+
# Stop development
51+
docker-compose -f docker-compose.dev.yml down
52+
53+
# Rebuild and start (after dependency changes)
54+
docker-compose -f docker-compose.dev.yml up --build -d
55+
56+
# View logs
57+
docker-compose -f docker-compose.dev.yml logs -f
58+
59+
# Start production
60+
docker-compose -f docker-compose.prod.yml up -d
61+
```
62+
63+
## 🐳 Docker Images
64+
65+
Automatic builds are available on DockerHub:
66+
67+
```bash
68+
# Latest development build
69+
docker pull sensenetcsp/sn-client:feature-docker-containerization
70+
71+
# Specific commit
72+
docker pull sensenetcsp/sn-client:feature-docker-containerization-abc1234
73+
74+
# Production (when merged to main)
75+
docker pull sensenetcsp/sn-client:latest
76+
```
77+
78+
## ⚙️ Configuration
79+
80+
### Environment Variables
81+
Both compose files support these environment variables:
82+
83+
- `NODE_ENV`: `development` or `production`
84+
- `AUTH_TYPE`: `SNAuth` or `IdentityServer`
85+
- `CHOKIDAR_USEPOLLING`: `true` (dev only, for file watching)
86+
- `WATCHPACK_POLLING`: `true` (dev only, for webpack)
87+
88+
### Port Configuration
89+
- **Default**: Port 8080 for both dev and prod
90+
- **Customizable**: Change the host port in docker-compose files
91+
92+
## 🔍 Troubleshooting
93+
94+
### Container won't start
95+
```bash
96+
# Check logs
97+
docker-compose -f docker-compose.dev.yml logs
98+
99+
# Rebuild from scratch
100+
docker-compose -f docker-compose.dev.yml down
101+
docker-compose -f docker-compose.dev.yml up --build
102+
```
103+
104+
### Hot reload not working
105+
- Ensure you're using the dev compose file
106+
- Restart the container if file watching stops working
107+
108+
### Port already in use
109+
```bash
110+
# Change the port in docker-compose file
111+
ports:
112+
- "3000:8080" # Use port 3000 instead of 8080
113+
```
114+
115+
## 📦 Build Process
116+
117+
The Docker build process:
118+
1. **Copy source code** (excluding files in `.dockerignore`)
119+
2. **Install dependencies** with `yarn install`
120+
3. **Build packages** with `yarn build`
121+
4. **Start application** with `yarn snapp start`
122+
123+
## 🚀 CI/CD
124+
125+
GitHub Actions automatically builds and pushes Docker images when:
126+
- Code is pushed to `feature/docker-containerization`
127+
- Pull requests target `develop`, `main`, or `feature/sn-auth-package-extraimprovements`
128+
129+
Images are tagged based on branch names and commit SHAs for easy identification.

0 commit comments

Comments
 (0)