Fix web app endpoint configuration

- Use relative /api endpoint in Dockerfile build
- Remove complex runtime replacement logic
- Simplify start.sh to avoid read-only filesystem issues
- Restore working Caddy configuration

Version 0.1.78 ready for deployment
This commit is contained in:
Your Name
2025-07-26 20:28:15 -06:00
parent d964d7d264
commit e95ad5c25f
3 changed files with 50 additions and 203 deletions

View File

@@ -27,21 +27,9 @@ RUN apt-get update && apt-get install -y git && \
# Will help default to yarn version 1.22.22
RUN corepack enable
# Set environment variables for web app build
# Instead of using a relative path, patch the origins.ts file to use dynamic origin
RUN echo "Patching origins.ts to use dynamic API endpoint based on current origin"
# Patch the origins.ts file to use relative API endpoint instead of hardcoded ente.io
RUN if [ -f "web/packages/base/origins.ts" ]; then \
echo "Patching origins.ts to use window.location.origin + '/api'"; \
sed -i 's|(await customAPIOrigin()) ?? "https://api.ente.io"|(await customAPIOrigin()) ?? (typeof window !== "undefined" ? window.location.origin + "/api" : "https://api.ente.io")|g' web/packages/base/origins.ts; \
sed -i 's|(await customAPIOrigin()) ?? "https://uploader.ente.io"|(await customAPIOrigin()) ?? (typeof window !== "undefined" ? window.location.origin + "/api" : "https://uploader.ente.io")|g' web/packages/base/origins.ts; \
echo "Patched origins.ts:"; \
cat web/packages/base/origins.ts | head -20; \
else \
echo "origins.ts not found, checking alternative paths"; \
find . -name "origins.ts" -type f; \
fi
# Set environment variables for web app build - use relative endpoint
ENV NEXT_PUBLIC_ENTE_ENDPOINT="/api"
RUN echo "Building with relative NEXT_PUBLIC_ENTE_ENDPOINT=/api for self-hosted deployment"
# Debugging the repository structure
RUN find . -type d -maxdepth 3 | sort