From 4d4a7c8c30bb166f38660e10fb68bef8bdd6ead5 Mon Sep 17 00:00:00 2001 From: tymur999 Date: Fri, 6 Mar 2026 22:44:56 -0600 Subject: [PATCH] podman container builds and runs --- .dockerignore | 4 +++ Dockerfile | 12 ++++++++ nginx.conf | 75 +++++++++++++++++++++++++++++++++++++++++++++++ webpack.config.ts | 6 ++-- 4 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b355810 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.idea +build +node_modules +.env* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..62cbecd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:latest AS build + +WORKDIR /blog +COPY package.json /blog/ +RUN npm install + +COPY . /blog/ +RUN npm run build + +FROM nginx:alpine +COPY --from=build /blog/build/ /var/www/html/ +COPY nginx.conf /etc/nginx/ \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d2bd50f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,75 @@ +worker_processes auto; +pid /tmp/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include mime.types; + + sendfile on; + tcp_nopush on; + # Prevent nginx HTTP Server Detection + server_tokens off; + + keepalive_timeout 65; + + server { + server_name tymur999.com; + listen 8000; + + # set max upload size and increase upload timeout: + client_max_body_size 10G; + client_body_timeout 300s; + + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto https; + + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # HTTP response headers borrowed from Nextcloud `.htaccess` + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "noindex, nofollow" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Path to the root of your installation + root /var/www/html; + index index.html; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # Serve static files + location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac)$ { + try_files $uri /index.php$request_uri; + add_header Cache-Control "public, max-age=15778463"; + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "noindex, nofollow" always; + add_header X-XSS-Protection "1; mode=block" always; + } + + location ~ \.(otf|woff2?)$ { + try_files $uri /index.php$request_uri; + expires 7d; # Cache-Control policy borrowed from `.htaccess` + } + + location / { + try_files $uri $uri/ /index.php$request_uri; + } + } +} \ No newline at end of file diff --git a/webpack.config.ts b/webpack.config.ts index 21d46f9..9f0ec99 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -84,7 +84,7 @@ const config: webpack.Configuration = { ], plugins: [ !isProduction && "react-refresh/babel", - ], + ].filter(Boolean), cacheDirectory: true, }, }, @@ -102,7 +102,7 @@ const config: webpack.Configuration = { ], plugins: [ !isProduction && "react-refresh/babel", - ], + ].filter(Boolean), cacheDirectory: true, } }, { @@ -156,7 +156,7 @@ const config: webpack.Configuration = { chunkFilename: "static/css/[name].[contenthash:8].chunk.css", }), !isProduction && new ReactRefreshWebpackPlugin(), - ], + ].filter(Boolean), devServer: { historyApiFallback: true, port: 3000,