FROM nginx:alpine

# Remove default nginx static assets
RUN rm -rf /usr/share/nginx/html/*

# Copy Custom NAS 3D CAD Viewer & Static Assets
COPY ./viewer /usr/share/nginx/html/viewer
COPY ./data /usr/share/nginx/html/data
COPY ./mechanical /usr/share/nginx/html/mechanical
COPY ./bom /usr/share/nginx/html/bom

# Copy default landing redirect
RUN echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=/viewer/index.html"></head></html>' > /usr/share/nginx/html/index.html

# Copy optimized nginx configuration
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
