threejs-test/Dockerfile
Juan Sebastian Montoya 5d6271f60c feat: add cache busting script for JS imports during Docker build
- Introduced a new script to append version query parameters to JS imports, ensuring proper cache busting in production.
- Updated Dockerfile to copy and execute the cache busting script during the build process.

This enhancement simplifies cache management for JavaScript files in production environments.
2025-11-26 19:39:59 -05:00

23 lines
708 B
Docker

FROM nginx:alpine
# Accept build argument for version
ARG VERSION=dev
ARG BUILD_DATE=unknown
# Create version.json file with build information
RUN printf '{"version":"%s","buildDate":"%s"}\n' "${VERSION}" "${BUILD_DATE}" > /usr/share/nginx/html/version.json
# Copy HTML and source files
COPY index.html /usr/share/nginx/html/
COPY src/ /usr/share/nginx/html/src/
# Copy and run cache busting script (bash/sed - no external dependencies needed)
COPY build-cache-bust.sh /tmp/build-cache-bust.sh
RUN chmod +x /tmp/build-cache-bust.sh && \
/tmp/build-cache-bust.sh "${VERSION}" /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80