From e135fe4822e4e822d3a24f40d1657862e9bc5017 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 15 Dec 2025 22:42:52 +0100 Subject: [PATCH] init --- .aiignore | 25 +++++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ js/vendor/.gitkeep | 0 nginx.conf | 22 ++++++++++++++++++++++ webpack.common.js | 16 ++++++++-------- webpack.config.dev.js | 18 +++++++++--------- webpack.config.prod.js | 22 +++++++++++----------- 8 files changed, 122 insertions(+), 28 deletions(-) create mode 100644 .aiignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml delete mode 100644 js/vendor/.gitkeep create mode 100644 nginx.conf diff --git a/.aiignore b/.aiignore new file mode 100644 index 0000000..ea02514 --- /dev/null +++ b/.aiignore @@ -0,0 +1,25 @@ +# An .aiignore file follows the same syntax as a .gitignore file. +# .gitignore documentation: https://git-scm.com/docs/gitignore + +# you can ignore files +.DS_Store +*.log +*.tmp + +# or folders +dist/ +build/ +out/ +# An .aiignore file follows the same syntax as a .gitignore file. +# .gitignore documentation: https://git-scm.com/docs/gitignore + +# you can ignore files +# or folders +.idea +node_modules/ +.vscode/ +.git +.github +scripts +.pytest_cache/ +__pycache__ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0039088 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Simple static site image: serve the contents of /public with nginx +FROM nginx:alpine +WORKDIR /usr/share/nginx/html + +# Copy static files +COPY public/ ./ + +# If the site references additional resources, copy them too +COPY resources/ ./resources + +# Provide custom nginx.conf for clean URLs +COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e6574a9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +services: + word: + build: + context: /opt/apps/word + dockerfile: Dockerfile + container_name: word + restart: unless-stopped + networks: + - traefik_net + - default + labels: + - "traefik.enable=true" + - "traefik.http.routers.word.rule=Host(`word.appmodel.nl`)" + - "traefik.http.routers.word.entrypoints=websecure" + - "traefik.http.routers.word.tls=true" + - "traefik.http.services.word.loadbalancer.server.port=80" + - "traefik.http.routers.word-http.rule=Host(`word.appmodel.nl`)" + - "traefik.http.routers.word-http.entrypoints=web" + - "traefik.http.routers.word-http.middlewares=word-https" + - "traefik.http.middlewares.word-https.redirectscheme.scheme=https" + - "traefik.http.routers.auction.tls.certresolver=letsencrypt", + - "traefik.http.middlewares.word-https.redirectscheme.permanent=true" + + healthcheck: + test: [ "CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));" ] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + + +networks: + traefik_net: + external: true + name: traefik_net diff --git a/js/vendor/.gitkeep b/js/vendor/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..c607e7b --- /dev/null +++ b/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Enable clean URLs without .html extension + location / { + # Try the exact URI, then with .html, then as directory with index.html, then 404 + try_files $uri $uri.html $uri/ =404; + } + + # Optional: Redirect .html URLs to clean URLs + if ($request_uri ~ ^/(.*)\.html(\?|$)) { + return 301 /$1$2; + } + + # Gzip compression for better performance + gzip on; + gzip_vary on; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; +} diff --git a/webpack.common.js b/webpack.common.js index b502ea9..6fb1522 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,12 +1,12 @@ -const path = require('path'); +const path = require('path') module.exports = { - entry: { - app: './js/app.js', + entry : { + app: './js/app.js' }, output: { - path: path.resolve(__dirname, 'dist'), - clean: true, - filename: './js/app.js', - }, -}; + path : path.resolve(__dirname, 'dist'), + clean : true, + filename: './js/app.js' + } +} diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 5953807..60f63f7 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -1,13 +1,13 @@ -const { merge } = require('webpack-merge'); -const common = require('./webpack.common.js'); +const { merge } = require('webpack-merge') +const common = require('./webpack.common.js') module.exports = merge(common, { - mode: 'development', - devtool: 'inline-source-map', + mode : 'development', + devtool : 'inline-source-map', devServer: { liveReload: true, - hot: true, - open: true, - static: ['./'], - }, -}); + hot : true, + open : true, + static : ['./'] + } +}) diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 76800e8..ef79d84 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -1,13 +1,13 @@ -const { merge } = require('webpack-merge'); -const common = require('./webpack.common.js'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CopyPlugin = require('copy-webpack-plugin'); +const { merge } = require('webpack-merge') +const common = require('./webpack.common.js') +const HtmlWebpackPlugin = require('html-webpack-plugin') +const CopyPlugin = require('copy-webpack-plugin') module.exports = merge(common, { - mode: 'production', + mode : 'production', plugins: [ new HtmlWebpackPlugin({ - template: './index.html', + template: './index.html' }), new CopyPlugin({ patterns: [ @@ -19,8 +19,8 @@ module.exports = merge(common, { { from: 'robots.txt', to: 'robots.txt' }, { from: 'icon.png', to: 'icon.png' }, { from: '404.html', to: '404.html' }, - { from: 'site.webmanifest', to: 'site.webmanifest' }, - ], - }), - ], -}); + { from: 'site.webmanifest', to: 'site.webmanifest' } + ] + }) + ] +})