Skip to main content

Docker deployment guide

ReactPress supports containerized deployment with Docker so you can run the same stack consistently across environments.

Docker architecture​

Production Docker setup uses multiple services:

  • db: MySQL 5.7
  • server: NestJS API
  • client: Next.js frontend
  • nginx: reverse proxy

Directory layout​

reactpress/
├── docker-compose.prod.yml
├── themes/hello-world/
├── server/Dockerfile
└── nginx.conf

Quick start​

1. Prerequisites​

docker --version
docker-compose --version

2. Clone the project​

git clone https://github.com/fecommunity/reactpress.git
cd reactpress

3. Environment variables​

Create .env in the project root:

DB_HOST=db
DB_PORT=3306
DB_USER=reactpress
DB_PASSWD=reactpress
DB_DATABASE=reactpress

CLIENT_SITE_URL=http://localhost:8080
SERVER_SITE_URL=http://localhost:8080
SERVER_API_URL=http://nginx/api

4. Start services​

docker-compose -f docker-compose.prod.yml up -d
docker-compose -f docker-compose.prod.yml ps
docker-compose -f docker-compose.prod.yml logs -f

Open http://localhost:8080.

Configuration​

VariableDefaultDescription
DB_HOSTdbDatabase host
DB_PORT3306Database port
DB_USERreactpressDatabase user
DB_PASSWDreactpressDatabase password
DB_DATABASEreactpressDatabase name
CLIENT_SITE_URLhttp://localhost:8080Public site URL
SERVER_SITE_URLhttp://localhost:8080Server URL
SERVER_API_URLhttp://nginx/apiAPI base URL

Port mapping​

ServiceContainerHostNotes
nginx808080Entry point
server30023002API
client30013001Frontend

Development with Docker​

Use docker-compose.dev.yml for hot reload and file sync. See the Chinese tutorial in the repo for a full dev compose example, or run:

reactpress docker start

Common operations​

# Production lifecycle
docker-compose -f docker-compose.prod.yml up -d
docker-compose -f docker-compose.prod.yml down
docker-compose -f docker-compose.prod.yml restart
docker-compose -f docker-compose.prod.yml ps
docker-compose -f docker-compose.prod.yml logs -f

# Database shell
docker exec -it reactpress_db mysql -u reactpress -p reactpress

Troubleshooting​

  1. Port conflict — change host ports in compose or stop the blocking process.
  2. Database connection refused — ensure the db service is healthy and .env matches compose.
  3. Permission errors — check volume mounts and container user permissions.

Security​

  • Change default database passwords in production.
  • Avoid exposing unnecessary ports.
  • Keep base images and dependencies updated.

For advanced tuning (resource limits, CI/CD), see the full Chinese guide in docs/tutorial/tutorial-extras/docker-deployment.md or open a discussion on GitHub.