diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d33031b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.gitignore +*.ps1 +ilias-babz-bund.txt +README.md +*.tmp +*.log +.venv +venv +scratch diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..865b175 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM nginx:alpine + +# Custom Nginx configuration with Articulate Storyline MIME and caching support +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Fallback htpasswd file (in production overridden via volume mount) +RUN touch /etc/nginx/.htpasswd + +# Copy static website assets +COPY index.html fw-logo.png /usr/share/nginx/html/ +COPY Documents/ /usr/share/nginx/html/Documents/ +COPY Trainings/ /usr/share/nginx/html/Trainings/ + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5f30458 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,37 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + charset utf-8; + + # Correct MIME types — critical for Articulate Storyline .js bundles + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + + location / { + try_files $uri $uri/ =404; + } + + # Protect Modul 6 with password + location ~* ^/Trainings/WBT_ErkW_6_Administration_erw_Funktionen(_Internet)?/ { + auth_basic "Administration Area"; + auth_basic_user_file /etc/nginx/.htpasswd; + try_files $uri $uri/ =404; + + # Cache static assets inside the protected directory + location ~* \.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|mp3|mp4)$ { + expires 30d; + add_header Cache-Control "public, immutable"; + } + } + + # Cache static assets aggressively (course files never change after deploy) + location ~* \.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|mp3|mp4)$ { + expires 30d; + add_header Cache-Control "public, immutable"; + } +}