FROM nginx:alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY index.html /usr/share/nginx/html/
COPY posts.html /usr/share/nginx/html/
COPY dashboard.html /usr/share/nginx/html/
COPY settings.html /usr/share/nginx/html/
COPY bookmarks.html /usr/share/nginx/html/
COPY daily-bookmarks.html /usr/share/nginx/html/
COPY automation.html /usr/share/nginx/html/
COPY login.html /usr/share/nginx/html/
COPY style.css /usr/share/nginx/html/
COPY dashboard.css /usr/share/nginx/html/
COPY settings.css /usr/share/nginx/html/
COPY ai-debug.css /usr/share/nginx/html/
COPY daily-bookmarks.css /usr/share/nginx/html/
COPY automation.css /usr/share/nginx/html/
COPY app.js /usr/share/nginx/html/
COPY dashboard.js /usr/share/nginx/html/
COPY settings.js /usr/share/nginx/html/
COPY ai-debug.js /usr/share/nginx/html/
COPY daily-bookmarks.js /usr/share/nginx/html/
COPY trade-fairs.js /usr/share/nginx/html/
COPY automation.js /usr/share/nginx/html/
COPY login.js /usr/share/nginx/html/
COPY vendor /usr/share/nginx/html/vendor/
COPY assets /usr/share/nginx/html/assets/

RUN set -e; \
  ASSET_VERSION="$(sha256sum \
    /usr/share/nginx/html/app.js \
    /usr/share/nginx/html/dashboard.js \
    /usr/share/nginx/html/settings.js \
    /usr/share/nginx/html/ai-debug.js \
    /usr/share/nginx/html/daily-bookmarks.js \
    /usr/share/nginx/html/trade-fairs.js \
    /usr/share/nginx/html/automation.js \
    /usr/share/nginx/html/login.js \
    /usr/share/nginx/html/vendor/list.min.js \
    /usr/share/nginx/html/style.css \
    /usr/share/nginx/html/dashboard.css \
    /usr/share/nginx/html/settings.css \
    /usr/share/nginx/html/ai-debug.css \
    /usr/share/nginx/html/daily-bookmarks.css \
    /usr/share/nginx/html/automation.css \
    | sha256sum | awk '{print $1}')"; \
  sed -i "s/__ASSET_VERSION__/${ASSET_VERSION}/g" /usr/share/nginx/html/index.html /usr/share/nginx/html/login.html

EXPOSE 80

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