diff --git a/Dockerfile.export b/docker/Dockerfile.export similarity index 84% rename from Dockerfile.export rename to docker/Dockerfile.export index 5c1807a..c4863d0 100644 --- a/Dockerfile.export +++ b/docker/Dockerfile.export @@ -25,4 +25,6 @@ RUN apk update --no-cache \ FROM nginx:alpine WORKDIR /app -COPY --from=builder /app/out /usr/share/nginx/html \ No newline at end of file +COPY --from=builder /app/docker/nginx/nginx.conf /etc/nginx/ +COPY --from=builder /app/docker/nginx/conf.d/default.conf /etc/nginx/conf.d/ +COPY --from=builder /app/out /usr/share/nginx/html diff --git a/docker/Dockerfile.export-mirror b/docker/Dockerfile.export-mirror new file mode 100644 index 0000000..9b035f4 --- /dev/null +++ b/docker/Dockerfile.export-mirror @@ -0,0 +1,35 @@ + +# Install dependencies only when needed +FROM node:lts-alpine AS deps +WORKDIR /app +# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. + +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ + && apk update --no-cache \ + && apk upgrade --no-cache \ + && apk add --no-cache libc6-compat \ + && yarn config set registry https://registry.npmmirror.com \ + && yarn config set sharp_binary_host "https://npmmirror.com/mirrors/sharp" \ + && yarn config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips" +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +# Rebuild the source code only when needed +FROM node:lts-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ + && apk update --no-cache \ + && apk upgrade --no-cache \ + && yarn config set registry https://registry.npmmirror.com \ + # && yarn build && yarn install --production --ignore-scripts --prefer-offline + && yarn build:export + +FROM nginx:alpine +WORKDIR /app +COPY --from=builder /app/docker/nginx/nginx.conf /etc/nginx/ +COPY --from=builder /app/docker/nginx/conf.d/default.conf /etc/nginx/conf.d/ +COPY --from=builder /app/out /usr/share/nginx/html + diff --git a/Dockerfile.mirror b/docker/Dockerfile.mirror similarity index 100% rename from Dockerfile.mirror rename to docker/Dockerfile.mirror diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf new file mode 100644 index 0000000..ec6abb6 --- /dev/null +++ b/docker/nginx/conf.d/default.conf @@ -0,0 +1,51 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + # Client side render + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ =404; + } + + #access_log /var/log/nginx/host.access.log main; + + # location / { + # root /usr/share/nginx/html; + # index index.html index.htm; + # } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + # error_page 500 502 503 504 /50x.html; + # location = /50x.html { + # root /usr/share/nginx/html; + # } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 0000000..5e076aa --- /dev/null +++ b/docker/nginx/nginx.conf @@ -0,0 +1,32 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/styles/globals.css b/styles/globals.css index faf4475..00e8eda 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -111,3 +111,7 @@ html { display: flex; justify-content: center; } + +.DocSearch-Button { + transition: all 0.3s ease-out; +}