[FEAT] Add separate frontend/backend Ingress and runtime API_URL configuration
- Add two Ingress: peikarband.ir (frontend) and api.peikarband.ir (backend) - Add runtime script to update .web/env.json from API_URL env var - Remove --backend-only flag to enable both frontend and backend - Configure API_URL from Helm values instead of build-time args - Update .dockerignore to include update-env-json.sh script
This commit is contained in:
@@ -63,6 +63,7 @@ RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
||||
COPY --chown=root:root . .
|
||||
|
||||
# Build and export Reflex app for production
|
||||
# Note: API_URL will be updated at runtime from environment variable
|
||||
# Export creates .web directory with frontend static files
|
||||
# bun is now pre-installed, so reflex export won't try to download it
|
||||
RUN python -m reflex export --no-zip
|
||||
@@ -128,6 +129,10 @@ COPY --from=builder /root/.local /home/peikarband/.local
|
||||
# Copy application code from builder
|
||||
COPY --from=builder /build /app
|
||||
|
||||
# Copy and set up runtime script
|
||||
COPY --chown=peikarband:peikarband scripts/update-env-json.sh /app/scripts/update-env-json.sh
|
||||
RUN chmod +x /app/scripts/update-env-json.sh
|
||||
|
||||
# Fix ownership
|
||||
RUN chown -R peikarband:peikarband /home/peikarband/.local /app
|
||||
|
||||
@@ -159,7 +164,8 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f -s -o /dev/null -w "%{http_code}" http://localhost:8000/ping | grep -q "200" || exit 1
|
||||
|
||||
# Use tini as init system for proper signal handling
|
||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||
# Update .web/env.json from API_URL env var, then run the app
|
||||
ENTRYPOINT ["/usr/bin/tini", "--", "/app/scripts/update-env-json.sh"]
|
||||
|
||||
# Run application (both frontend and backend)
|
||||
CMD ["python", "-m", "reflex", "run", "--env", "prod"]
|
||||
|
||||
Reference in New Issue
Block a user