diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..ae6ecae5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.docusaurus/ +node_modules/ +build/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 05e50ca7..927812fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,23 +2,22 @@ FROM node:20-alpine3.17 AS builder WORKDIR /app -COPY . . +COPY package*.json . + +RUN npm ci -RUN npm install \ -&& npm run build +COPY . . -FROM nginx:1.25.1-alpine AS runner +RUN npm run build -WORKDIR /usr/share/nginx/docs +FROM ghcr.io/patrickdappollonio/docker-http-server:v2.4.0 -ENV NODE_ENV production +WORKDIR /html COPY --from=builder /app/build/ . -COPY default.conf /etc/nginx/conf.d/ - -EXPOSE 80 +ENV PORT=80 -ENV PORT 80 +ENTRYPOINT ["/http-server"] -CMD ["nginx", "-g", "daemon off;"] +CMD ["--pathprefix=/docs/", "--disable-directory-listing", "--custom-404=404.html"] diff --git a/default.conf b/default.conf deleted file mode 100644 index 230843b9..00000000 --- a/default.conf +++ /dev/null @@ -1,29 +0,0 @@ -server { - listen 80; - server_name localhost; - - location /docs { - root /usr/share/nginx/; - - # redirect /docs/google/ to /docs/gcp/ for any subpath - rewrite ^/docs/google/(.*)/$ $scheme://$http_host/docs/gcp/$1/ last; - rewrite ^/docs/google/(.*)$ $scheme://$http_host/docs/gcp/$1 last; - - # redirect /docs/digitalocean/ to /docs/do/ for any subpath - rewrite ^/docs/digitalocean/(.*)/$ $scheme://$http_host/docs/do/$1/ last; - rewrite ^/docs/digitalocean/(.*)$ $scheme://$http_host/docs/do/$1 last; - - index index.html index.htm; - # try_files $uri $uri/ /index.html; - autoindex off; - } - - error_page 404 = /404.html; - location /404.html { - root /usr/share/nginx/docs; - } - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/docs; - } -} diff --git a/static/_redirections b/static/_redirections new file mode 100644 index 00000000..0e15516d --- /dev/null +++ b/static/_redirections @@ -0,0 +1,36 @@ +# This break for files under /docs. Opting +# to manually list all redirects to /overview for now +# Eg. sitemap -> /docs/sitemap.xml/overview +# redirect to overviews +# /docs/:name /docs/:name/overview permanent +# /docs/:name/ /docs/:name/overview/ permanent + +/docs/k3d /docs/k3d/overview permanent +/docs/k3d/ /docs/k3d/overview/ permanent + +/docs/akamai /docs/akamai/overview permanent +/docs/akamai/ /docs/akamai/overview/ permanent + +/docs/aws /docs/aws/overview permanent +/docs/aws/ /docs/aws/overview/ permanent + +/docs/civo /docs/civo/overview permanent +/docs/civo/ /docs/civo/overview/ permanent + +# redirect /docs/google/* to /docs/gcp/* +/docs/digitalocean/:splat /docs/do/:splat permanent +/docs/digitalocean /docs/do permanent +/docs/do /docs/do/overview permanent +/docs/do/ /docs/do/overview/ permanent + +# redirect /docs/google/* to /docs/gcp/* +/docs/google/:splat /docs/gcp/:splat permanent +/docs/google /docs/gcp permanent +/docs/gcp /docs/gcp/overview permanent +/docs/gcp/ /docs/gcp/overview/ permanent + +/docs/k3s /docs/k3s/overview permanent +/docs/k3s/ /docs/k3s/overview/ permanent + +/docs/vultr /docs/vultr/overview permanent +/docs/vultr/ /docs/vultr/overview/ permanent