Update frontend

This commit is contained in:
dvirlabs 2025-12-07 10:33:59 +02:00
parent b4008f5b93
commit 02541a62ea
4 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
set -e
# Don't use set -e to avoid crashing if chown fails
# Generate env.js from API_BASE environment variable
# This is set in the Helm deployment values
@ -9,7 +9,7 @@ TARGET="/usr/share/nginx/html/env.js"
# Default to /api as fallback (relative path)
: ${API_BASE:=/api}
echo "Generating env.js with API_BASE=${API_BASE}"
echo "[ENTRYPOINT] Generating env.js with API_BASE=${API_BASE}"
cat > "$TARGET" <<EOF
window.__ENV__ = {
@ -17,7 +17,15 @@ window.__ENV__ = {
};
EOF
echo "✓ env.js generated at $TARGET"
if [ -f "$TARGET" ]; then
echo "[ENTRYPOINT] ✓ env.js generated successfully at $TARGET"
cat "$TARGET"
else
echo "[ENTRYPOINT] ✗ Failed to generate env.js"
exit 1
fi
# Ensure ownership/permissions for nginx
chown -R nginx:nginx /usr/share/nginx/html || true
# Ensure ownership/permissions for nginx (don't fail if this doesn't work)
chown nginx:nginx /usr/share/nginx/html/env.js 2>/dev/null || echo "[ENTRYPOINT] Note: Could not change ownership (not critical)"
echo "[ENTRYPOINT] env.js setup complete"

View File

@ -28,8 +28,9 @@ COPY --from=builder /app/dist /usr/share/nginx/html
# This will run before nginx starts and generate env.js from API_BASE env var
COPY 10-generate-env.sh /docker-entrypoint.d/10-generate-env.sh
# Ensure entrypoint script is executable
RUN chmod +x /docker-entrypoint.d/10-generate-env.sh
# Ensure entrypoint script is executable and has correct line endings
RUN chmod +x /docker-entrypoint.d/10-generate-env.sh && \
sed -i 's/\r$//' /docker-entrypoint.d/10-generate-env.sh
EXPOSE 80