diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8b3da3e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,38 @@ +# Hugo build artifacts +.hugo_build.lock +hugo_stats.json +public/ +resources/ + +# Node.js +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Development files +.editorconfig +.git/ +.gitignore +*.md +docs/ + +# OS files +.DS_Store +Thumbs.db + +# Backup files +*.backup +*.bak +*.tmp + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Build artifacts +dist/ +build/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5775347 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use a Node.js LTS Alpine image as the base +FROM hugomods/hugo:nightly + +# Install Node.js and npm (needed for fetch-wordpress.js and sass) +RUN apk add --no-cache nodejs npm + +# Install Sass (Dart Sass) globally +RUN npm install -g sass + +# Set the working directory inside the container +WORKDIR /app + +# Copy the entire project into the container +COPY . . + +# Make the build script executable (if not already) +RUN chmod +x scripts/build.sh + +# Install Node.js dependencies if any (e.g., for fetch-wordpress.js) +# Assuming package.json exists and has dependencies +RUN if [ -f package.json ]; then npm install; fi + +# Ensure /usr/local/bin is in PATH for the CMD +ENV PATH="/usr/local/bin:$PATH" + +# Command to run the build script when the container starts +CMD ["./scripts/build.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6c1452c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +networks: + web: + external: true + +services: + nginx: + image: nginx:alpine + ports: + - "80:80" + volumes: + - ./public:/usr/share/nginx/html:ro + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + restart: unless-stopped + environment: + - NGINX_HOST=localhost + - NGINX_PORT=80 + networks: + - web + + builder: + build: + context: . + dockerfile: Dockerfile + entrypoint: /bin/sh + volumes: + - .:/app + networks: + - web + # command: ls -l diff --git a/hugo.toml b/hugo.toml index 3e3dcb8..283714a 100644 --- a/hugo.toml +++ b/hugo.toml @@ -7,13 +7,6 @@ ignoreLogs = ["warning-goldmark-raw-html"] # [permalinks] # posts = "/:section/:slug/" -[languages] - [languages.fr] - languageCode = 'fr-FR' - languageDirection = 'ltr' - languageName = 'French' - weight = 1 - # [taxonomies] # category = "categories" @@ -38,8 +31,9 @@ ignoreLogs = ["warning-goldmark-raw-html"] site = "@mistergeekfrance" creator = "@mistergeekfrance" - facebook_page = "mistergeekfrance" - # youtube_channel = "UCXXXXXXXXXXXXXXXXXXX" + # Facebook + facebook_page = "mistergeek.fr" + youtube_channel = "UCXXXXXXXXXXXXXXXXXXX" # Search Engine Verification # google_verification = "your-google-verification-code" @@ -47,14 +41,14 @@ ignoreLogs = ["warning-goldmark-raw-html"] # yandex_verification = "your-yandex-verification-code" # Local SEO - # [params.seo.local] - # enabled = true - # country = "FR" - # language = "fr" - # region = "Île-de-France" - # city = "Paris" - # latitude = "48.8566" - # longitude = "2.3522" + [params.seo.local] + enabled = true + country = "FR" + language = "fr" + region = "Île-de-France" + city = "Paris" + latitude = "48.8566" + longitude = "2.3522" # Rich snippets enable_search_box = true diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3132165..6077d75 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -6,11 +6,11 @@

{{ .Title }}

diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..53b1d73 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,35 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html index.htm; + + # Enable gzip compression + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Security headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Main location block + location / { + try_files $uri $uri/ /index.html; + } + + # Health check endpoint + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } +} diff --git a/package-lock.json b/package-lock.json index 1c23602..baa23c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "node-fetch": "^3.3.2" }, "devDependencies": { - "sass": "^1.90.0" + "sass": "^1.69.5" } }, "node_modules/@parcel/watcher": { diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..aadec7f --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# Exit immediately if a command exits with a non-zero status. +set -e + +echo "Building CSS..." +# Assuming sass is installed and available in the environment or Docker image +# Compile theme.scss to theme.css +sass assets/css/scss/theme.scss static/assets/css/theme.css + +echo "Fetching content from WordPress..." +# Assuming Node.js is installed and available in the environment or Docker image +node scripts/fetch-wordpress.js + +echo "Generating production build with Hugo..." + +# Assuming Hugo is installed and available in the environment or Docker image +hugo --minify --environment production --config hugo.toml + +echo "Build process completed successfully!" diff --git a/yarn.lock b/yarn.lock index dd354c1..8b6e0af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,46 +2,6 @@ # yarn lockfile v1 -"@parcel/watcher-android-arm64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz" - integrity sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA== - -"@parcel/watcher-darwin-arm64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz" - integrity sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw== - -"@parcel/watcher-darwin-x64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz" - integrity sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg== - -"@parcel/watcher-freebsd-x64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz" - integrity sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ== - -"@parcel/watcher-linux-arm-glibc@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz" - integrity sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA== - -"@parcel/watcher-linux-arm-musl@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz" - integrity sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q== - -"@parcel/watcher-linux-arm64-glibc@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz" - integrity sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w== - -"@parcel/watcher-linux-arm64-musl@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz" - integrity sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg== - "@parcel/watcher-linux-x64-glibc@2.5.1": version "2.5.1" resolved "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz" @@ -52,21 +12,6 @@ resolved "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz" integrity sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg== -"@parcel/watcher-win32-arm64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz" - integrity sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw== - -"@parcel/watcher-win32-ia32@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz" - integrity sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ== - -"@parcel/watcher-win32-x64@2.5.1": - version "2.5.1" - resolved "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz" - integrity sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA== - "@parcel/watcher@^2.4.1": version "2.5.1" resolved "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz" @@ -201,7 +146,7 @@ readdirp@^4.0.1: resolved "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz" integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== -sass@^1.90.0: +sass@^1.69.5: version "1.90.0" resolved "https://registry.npmjs.org/sass/-/sass-1.90.0.tgz" integrity sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==