![]() * Add production-one-port example A more complex version of simple-one-port that facilitates better layer caching to shorten build times and multi-stage build to reduce final image size. Harder to understand, but ultimately nicer to use. * fix Caddyfile format to avoid complaints * docker-examples: bump all base images to python:3.13 |
||
---|---|---|
.. | ||
.dockerignore | ||
Dockerfile | ||
README.md |
simple-two-port
This docker deployment runs Reflex in prod mode, exposing two HTTP ports:
3000
- node NextJS server using optimized production build8000
- python gunicorn server hosting the Reflex backend
The deployment also runs a local Redis server to store state for each user.
Build
docker build -t reflex-simple-two-port .
Run
docker run -p 3000:3000 -p 8000:8000 reflex-simple-two-port
Note that this container has no persistence and will lose all data when stopped. You can use bind mounts or named volumes to persist the database and uploaded_files directories as needed.
Usage
This container should be used with an existing load balancer or reverse proxy to route traffic to the appropriate port inside the container.
For example, the following Caddyfile can be used to terminate TLS and forward traffic to the frontend and backend from outside the container.
my-domain.com
encode gzip
@backend_routes path /_event/* /ping /_upload /_upload/*
handle @backend_routes {
reverse_proxy localhost:8000
}
reverse_proxy localhost:3000