Skip to content

Commit 86652da

Browse files
committed
feat: add Docker containerization support
- Add Dockerfile for SenseNet client application - Add docker-compose.dev.yml for development with hot reload - Add docker-compose.prod.yml for production deployment - Add .dockerignore for optimized builds - Add .env.example for environment configuration Usage: - Development: docker-compose -f docker-compose.dev.yml up -d - Production: docker-compose -f docker-compose.prod.yml up -d
1 parent b40c396 commit 86652da

File tree

5 files changed

+133
-0
lines changed

5 files changed

+133
-0
lines changed

.dockerignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Node modules (will be installed in container)
2+
node_modules
3+
*/node_modules
4+
**/node_modules
5+
6+
# Build outputs
7+
dist
8+
build
9+
coverage
10+
*.tsbuildinfo
11+
12+
# Development files
13+
.git
14+
.github
15+
.vscode
16+
*.log
17+
# Note: We need yarn.lock and package-lock.json for dependency resolution
18+
# *.lock
19+
20+
# Docker
21+
*.dockerignore
22+
Dockerfile*
23+
docker-compose*
24+
.docker
25+
26+
# Docker volumes
27+
docker_data/
28+
docker_volumes/
29+
30+
# Development
31+
.env.local
32+
.env.development.local
33+
.env.test.local
34+
.env.production.local
35+
36+
# Cypress
37+
cypress/videos
38+
cypress/screenshots
39+
40+
# Misc
41+
.DS_Store
42+
Thumbs.db

.env.example

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Environment Variables for Docker Compose
2+
# Copy this file to .env and modify as needed
3+
4+
# Authentication Type (SNAuth or IdentityServer)
5+
AUTH_TYPE=SNAuth
6+
7+
# Node Environment
8+
NODE_ENV=production
9+
10+
# Ports
11+
SENSENET_CLIENT_PORT=8080
12+
SENSENET_DEV_PORT=3000
13+
14+
# Development Settings (for hot reload)
15+
CHOKIDAR_USEPOLLING=true
16+
WATCHPACK_POLLING=true
17+
18+
# Database Settings (if using database service)
19+
# DB_PASSWORD=YourPassword123!
20+
# DB_NAME=SenseNet
21+
# DB_USER=sa
22+
23+
# Redis Settings (if using redis service)
24+
# REDIS_PASSWORD=
25+
26+
# Traefik Settings (if using traefik service)
27+
# TRAEFIK_DOMAIN=sensenet.local
28+
29+
# Backend API URL (if connecting to external backend)
30+
# REACT_APP_SERVICE_URL=https://dev.demo.sensenet.com
31+
# REACT_APP_IDENTITY_SERVER_URL=https://is.demo.sensenet.com

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Development Dockerfile for SenseNet client with hot reload
2+
FROM node:20-alpine
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Copy everything (dockerignore excludes unwanted files)
8+
COPY . .
9+
10+
# Install dependencies
11+
RUN yarn install
12+
13+
# Build packages (required for the app to work)
14+
RUN yarn build
15+
16+
# Expose port
17+
EXPOSE 8080
18+
19+
# Health check
20+
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
21+
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
22+
23+
# Default command (overridden in docker-compose for hot reload)
24+
CMD ["yarn", "snapp", "start"]

docker-compose.dev.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: "3.8"
2+
3+
services:
4+
sensenet-dev:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: sensenet-dev
9+
ports:
10+
- "8080:8080"
11+
environment:
12+
- NODE_ENV=development
13+
- AUTH_TYPE=SNAuth
14+
- CHOKIDAR_USEPOLLING=true
15+
- WATCHPACK_POLLING=true
16+
volumes:
17+
- .:/app
18+
- /app/node_modules
19+
- /app/packages/*/node_modules
20+
- /app/apps/*/node_modules
21+
command: yarn snapp start
22+
restart: unless-stopped

docker-compose.prod.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.8"
2+
3+
services:
4+
sensenet-app:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: sensenet-app
9+
ports:
10+
- "8080:8080"
11+
environment:
12+
- NODE_ENV=production
13+
- AUTH_TYPE=SNAuth
14+
restart: unless-stopped

0 commit comments

Comments
 (0)