Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.12


ENV REDIS_URL=redis://redis PYTHONUNBUFFERED=1

WORKDIR /app
COPY . .

RUN pip install -r requirements.txt


ENTRYPOINT ["reflex", "run", "--env", "prod", "--backend-only", "--loglevel", "debug" ]
18 changes: 18 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
backend:
build:
dockerfile: Dockerfile
ports:
- 8000:8000
depends_on:
- redis
frontend:
build:
dockerfile: web.Dockerfile
ports:
- 3000:80
depends_on:
- backend
redis:
image: redis

33 changes: 33 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
server {
listen 80;
listen [::]:80;
server_name frontend;


error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location /_event {
proxy_set_header Connection "upgrade";
proxy_pass http://backend:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
}

location /ping {
proxy_pass http://backend:8000;
}

location /_upload {
proxy_pass http://backend:8000;
}

location / {
# This would be the directory where your Reflex app's static files are stored at
root /usr/share/nginx/html;
try_files $uri /$uri/index.html;
}

}
12 changes: 12 additions & 0 deletions web.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.12 AS builder

WORKDIR /app

COPY . .
RUN pip install -r requirements.txt
RUN reflex export --frontend-only --no-zip

FROM nginx

COPY --from=builder /app/.web/_static /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf