diff --git a/.gitignore b/.gitignore index 47cb8fa..f0dd841 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tasko-chart/ -invy-chart/ \ No newline at end of file +invy-chart/ +values.yaml \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index b1f9711..8533692 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -43,6 +43,12 @@ RUN echo 'server {' > /etc/nginx/conf.d/default.conf && \ echo ' try_files $uri $uri/ /index.html;' >> /etc/nginx/conf.d/default.conf && \ echo ' }' >> /etc/nginx/conf.d/default.conf && \ echo '' >> /etc/nginx/conf.d/default.conf && \ + echo ' # Serve runtime config' >> /etc/nginx/conf.d/default.conf && \ + echo ' location /config.js {' >> /etc/nginx/conf.d/default.conf && \ + echo ' expires -1;' >> /etc/nginx/conf.d/default.conf && \ + echo ' add_header Cache-Control "no-store, no-cache, must-revalidate";' >> /etc/nginx/conf.d/default.conf && \ + echo ' }' >> /etc/nginx/conf.d/default.conf && \ + echo '' >> /etc/nginx/conf.d/default.conf && \ echo ' # Cache static assets' >> /etc/nginx/conf.d/default.conf && \ echo ' location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {' >> /etc/nginx/conf.d/default.conf && \ echo ' expires 1y;' >> /etc/nginx/conf.d/default.conf && \ @@ -53,9 +59,17 @@ RUN echo 'server {' > /etc/nginx/conf.d/default.conf && \ # Copy built files from build stage COPY --from=build /app/dist /usr/share/nginx/html +# Create entrypoint script for runtime config +RUN echo '#!/bin/sh' > /docker-entrypoint.sh && \ + echo 'echo "window.ENV = {" > /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'echo " VITE_API_URL: \"${VITE_API_URL:-http://localhost:8000}\"" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'echo "}" >> /usr/share/nginx/html/config.js' >> /docker-entrypoint.sh && \ + echo 'exec nginx -g "daemon off;"' >> /docker-entrypoint.sh && \ + chmod +x /docker-entrypoint.sh + # Expose port 80 EXPOSE 80 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] +# Start nginx with entrypoint +CMD ["/docker-entrypoint.sh"] diff --git a/frontend/index.html b/frontend/index.html index ddb3985..615996f 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,6 +5,7 @@