diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..63a0bd8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +dist +.git +.github diff --git a/Dockerfile b/Dockerfile index d0d4b6f..b9ff072 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,5 +6,7 @@ COPY . . RUN npm run build FROM nginx:alpine +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 diff --git a/index.html b/index.html index 96a93c6..2aaf97e 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
- +
Turn: 0 Future: 0/0 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..4ec631e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + # MIME types (includes JS, CSS, and all standard types) + include /etc/nginx/mime.types; + + # Gzip compression + gzip on; + gzip_types text/plain text/css application/javascript application/json image/svg+xml; + gzip_min_length 256; + + # Static assets with cache headers + location /assets/ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + # SPA fallback — serve index.html for all non-file routes + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/vite.config.ts b/vite.config.ts index e59758d..5ba6920 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vite'; export default defineConfig({ + base: './', build: { target: 'ES2022', },