From 78d0cfd421cd55f50c60c7e31bb337a1b518a3cb Mon Sep 17 00:00:00 2001 From: milldr Date: Fri, 20 Sep 2024 15:56:42 -0400 Subject: [PATCH 1/3] Add Dockerfile loader and customize HTML loader options --- docs/layers/project/toolbox.mdx | 23 +++++++++-- plugins/custom-loaders/index.js | 67 ++++++++++++++++----------------- 2 files changed, 52 insertions(+), 38 deletions(-) diff --git a/docs/layers/project/toolbox.mdx b/docs/layers/project/toolbox.mdx index 1ed116369..d1eff6e8a 100644 --- a/docs/layers/project/toolbox.mdx +++ b/docs/layers/project/toolbox.mdx @@ -8,6 +8,7 @@ import Intro from '@site/src/components/Intro'; import ActionCard from '@site/src/components/ActionCard'; import PrimaryCTA from '@site/src/components/PrimaryCTA'; import DismissibleDialog from '@site/src/components/DismissibleDialog'; +import PartialDockerfile from '@site/examples/snippets/components/docker/infra-acme/Dockerfile'; import Note from '@site/src/components/Note'; @@ -33,11 +34,13 @@ Geodesic is a powerful Linux toolbox container designed to optimize DevOps workf ## Building the Toolbox Image -Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built -from the `Dockerfile` using a `Makefile`. +Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built from the `Dockerfile` using a `Makefile`. We customize this `Dockerfile` for your organization, but please see the following example for reference. -The standard `Makefile` includes a number of commands. In order to build the initial, complete Geodesic image, run the -following: + + {PartialDockerfile} + + +The standard `Makefile` includes a number of commands. In order to build the initial, complete Geodesic image, run the following: ```bash make all @@ -45,6 +48,18 @@ make all On future builds, use `make run` to use the cached image. +:::tip Alias + +We install a wrapper script with `make all` to your chosen namespace in the `Makefile`. For example, simply enter for given namespace to start your Geodesic container once built: + +```bash +acme +``` + +See the `install` step of the `Makefile` for more details. + +::: + Build the toolbox image locally before continuing. Follow the [toolbox image setup steps in the How-to Get Started guide](/layers/project/#building-the-toolbox-image). In short, diff --git a/plugins/custom-loaders/index.js b/plugins/custom-loaders/index.js index 2206123b6..f24608f94 100644 --- a/plugins/custom-loaders/index.js +++ b/plugins/custom-loaders/index.js @@ -8,41 +8,40 @@ const html = require('html-loader'); const path = require('path'); module.exports = function (context, options) { - return { - name: 'custom-loaders', - configureWebpack(config, isServer) { - return { - /*output: { - filename: 'custom-loaders-webpack.bundle.js', - },*/ - - module: { - rules: [ - // { test: /\.txt$/, use: 'raw-loader' }, - // https://webpack.js.org/loaders/html-loader/ - { - test: /\.(html|htm)$/i, - loader: "html-loader", - options: { - minimize: { - removeComments: false, - collapseWhitespace: false, - }, + return { + name: 'custom-loaders', + configureWebpack(config, isServer) { + return { + module: { + rules: [ + // Existing rule for HTML files + { + test: /\.(html|htm)$/i, + loader: 'html-loader', + options: { + minimize: { + removeComments: false, + collapseWhitespace: false, }, }, - { - test: /\.(txt|yml|yaml|tf)$/, - use: 'raw-loader' - } - ], - }, + }, + { + test: /\.(txt|yml|yaml|tf)$/i, + use: 'raw-loader', + }, + { + test: /^Dockerfile$/i, // Matches files named exactly 'Dockerfile' (case-insensitive) + use: 'raw-loader', + }, + ], + }, - resolve: { - alias: { - '@examples': path.resolve(__dirname, 'examples'), - } - } - }; - }, - }; + resolve: { + alias: { + '@examples': path.resolve(__dirname, 'examples'), + }, + }, + }; + }, }; +}; From 0892914ffe5f85d767ce29d18de4ea5d6c1b5e92 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 23 Sep 2024 09:51:29 -0400 Subject: [PATCH 2/3] Update docs/layers/project/toolbox.mdx Co-authored-by: Erik Osterman (CEO @ Cloud Posse) --- docs/layers/project/toolbox.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers/project/toolbox.mdx b/docs/layers/project/toolbox.mdx index d1eff6e8a..c86f8f852 100644 --- a/docs/layers/project/toolbox.mdx +++ b/docs/layers/project/toolbox.mdx @@ -34,7 +34,7 @@ Geodesic is a powerful Linux toolbox container designed to optimize DevOps workf ## Building the Toolbox Image -Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built from the `Dockerfile` using a `Makefile`. We customize this `Dockerfile` for your organization, but please see the following example for reference. +Build a Geodesic infrastructure container. This container that has all the tools like terraform and atmos for building infrastructure. It's built from the `Dockerfile` and there are some predefined targets defined in the `Makefile`, to make this easy. Customize this `Dockerfile` for your organization. Here's an example for reference. {PartialDockerfile} From 8d22a1e395b8ac1accc7df5d619a350c7d11074b Mon Sep 17 00:00:00 2001 From: milldr Date: Mon, 23 Sep 2024 10:14:58 -0400 Subject: [PATCH 3/3] Add CodeBlock and Makefile for Geodesic toolbox setup --- docs/layers/project/toolbox.mdx | 11 +++++++++-- docusaurus.config.js | 4 +--- examples/snippets/Makefile | 1 + plugins/custom-loaders/index.js | 2 +- plugins/dynamicRedirects/index.js | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 examples/snippets/Makefile diff --git a/docs/layers/project/toolbox.mdx b/docs/layers/project/toolbox.mdx index d1eff6e8a..70f742c22 100644 --- a/docs/layers/project/toolbox.mdx +++ b/docs/layers/project/toolbox.mdx @@ -8,7 +8,10 @@ import Intro from '@site/src/components/Intro'; import ActionCard from '@site/src/components/ActionCard'; import PrimaryCTA from '@site/src/components/PrimaryCTA'; import DismissibleDialog from '@site/src/components/DismissibleDialog'; +import CodeBlock from '@theme/CodeBlock'; +import CollapsibleText from '@site/src/components/CollapsibleText'; import PartialDockerfile from '@site/examples/snippets/components/docker/infra-acme/Dockerfile'; +import PartialMakefile from '@site/examples/snippets/Makefile'; import Note from '@site/src/components/Note'; @@ -34,12 +37,16 @@ Geodesic is a powerful Linux toolbox container designed to optimize DevOps workf ## Building the Toolbox Image -Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built from the `Dockerfile` using a `Makefile`. We customize this `Dockerfile` for your organization, but please see the following example for reference. +Build the Geodesic infrastructure container. This is a container that has all the tools for building the app. It's built from the `Dockerfile` using a `Makefile`. We customize both for your organization, but please see the following examples for reference. {PartialDockerfile} + + {PartialMakefile} + + The standard `Makefile` includes a number of commands. In order to build the initial, complete Geodesic image, run the following: ```bash @@ -50,7 +57,7 @@ On future builds, use `make run` to use the cached image. :::tip Alias -We install a wrapper script with `make all` to your chosen namespace in the `Makefile`. For example, simply enter for given namespace to start your Geodesic container once built: +We install a wrapper script with `make all` to your chosen namespace. For example, simply enter for given namespace to start your Geodesic container once built: ```bash acme diff --git a/docusaurus.config.js b/docusaurus.config.js index 898392f0c..969211a5a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -77,9 +77,7 @@ async function createConfig() { disableInDev: false, } ], - [ - 'custom-loaders', {} - ], + path.resolve(__dirname, 'plugins/custom-loaders'), metadataPlugin, [ "posthog-docusaurus", diff --git a/examples/snippets/Makefile b/examples/snippets/Makefile new file mode 100644 index 000000000..be81ddb2c --- /dev/null +++ b/examples/snippets/Makefile @@ -0,0 +1 @@ +# placeholder until example is created diff --git a/plugins/custom-loaders/index.js b/plugins/custom-loaders/index.js index f24608f94..1240810f6 100644 --- a/plugins/custom-loaders/index.js +++ b/plugins/custom-loaders/index.js @@ -30,7 +30,7 @@ module.exports = function (context, options) { use: 'raw-loader', }, { - test: /^Dockerfile$/i, // Matches files named exactly 'Dockerfile' (case-insensitive) + test: /(?:Dockerfile|Makefile)$/i, use: 'raw-loader', }, ], diff --git a/plugins/dynamicRedirects/index.js b/plugins/dynamicRedirects/index.js index e70fb8ff2..35b01bb37 100644 --- a/plugins/dynamicRedirects/index.js +++ b/plugins/dynamicRedirects/index.js @@ -35,7 +35,7 @@ async function loadRedirects(allContent) { } }); - console.debug('Loaded redirects:', redirects); + // console.debug('Loaded redirects:', redirects); return redirects; } @@ -60,7 +60,7 @@ function redirectsPlugin(context, options) { redirects, }); - console.debug('Global data set with redirects.'); + // console.debug('Global data set with redirects.'); }, }; }