Khaleel Al-Adhami ead1041759 prettier (#4941) 2 月之前
..
.dockerignore fa894289d4 Update docker-example (#3324) 8 月之前
Dockerfile 0a34949019 Add production-one-port example (#4489) 5 月之前
README.md ead1041759 prettier (#4941) 2 月之前

README.md

simple-two-port

This docker deployment runs Reflex in prod mode, exposing two HTTP ports:

  • 3000 - node NextJS server using optimized production build
  • 8000 - 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