From 914d614f3eceb4e66886662cd9774bfe60cd28c3 Mon Sep 17 00:00:00 2001 From: Grzegorz Kucmierz Date: Sun, 8 Feb 2026 04:27:43 +0100 Subject: [PATCH] update --- .dockerignore | 11 +++++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++ docker-compose.yml | 14 +++++++++++ nginx.conf | 44 +++++++++++++++++++++++++++++++++++ src/components/GuidePanel.vue | 6 ----- 5 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2c86fda --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +node_modules +dist +.git +.gitignore +.idea +.vscode +*.md +Dockerfile +docker-compose.yml +npm-debug.log +yarn-error.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9441c79 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# Stage 1: Build the application +FROM node:lts-alpine as build-stage + +# Set working directory +WORKDIR /app + +# Copy package files first to leverage Docker cache +COPY package*.json ./ + +# Install dependencies +# using npm ci for cleaner, reliable builds (requires package-lock.json) +RUN npm ci + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Stage 2: Serve the application with Nginx +FROM nginx:stable-alpine as production-stage + +# Copy the built artifacts from the build stage +# Assuming Vite defaults to /app/dist +COPY --from=build-stage /app/dist /usr/share/nginx/html + +# Copy custom Nginx configuration +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port 80 +EXPOSE 80 + +# Healthcheck to ensure Nginx is running and serving +HEALTHCHECK --interval=30s --timeout=3s \ + CMD wget --quiet --tries=1 --spider http://localhost/health || exit 1 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a2c9995 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + app: + container_name: nonograms-app + build: + context: . + dockerfile: Dockerfile + ports: + - "8080:80" + restart: unless-stopped + # Uncomment the following lines if you want to mount the configuration locally for development/testing + # volumes: + # - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..45be951 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,44 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_min_length 10240; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript; + gzip_disable "MSIE [1-6]\."; + + # Security Headers + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + add_header Referrer-Policy "strict-origin-when-cross-origin"; + # CSP: Adjust as needed. This is a strict starting point. + # Allowing unsafe-inline for styles is often necessary for Vue apps unless using nonces. + add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:;"; + + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + expires 1y; + add_header Cache-Control "public, no-transform"; + } + + # Health check + location /health { + access_log off; + return 200 "healthy\n"; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/src/components/GuidePanel.vue b/src/components/GuidePanel.vue index 88be2a4..d354ca0 100644 --- a/src/components/GuidePanel.vue +++ b/src/components/GuidePanel.vue @@ -66,9 +66,3 @@ const { font-size: 0.8rem; } -